@oneblink/apps-react
    Preparing search index...

    Function executeCancelAction

    • Action to cancel completing a form, currently goes back in the browser history or attempts to close the browser tab if there is no history.

      const options = {
      definition: OneBlinkForm,
      externalId: 'external-id-set-by-developer',
      }
      // Only used for relative URLs
      const pushRelativePath = (path) => {
      window.location.href = path
      }
      // Only used for aboslute URLS
      const replaceAbsolutePath = window.location.replace

      try {
      await submissionService.executeCancelAction(options, {
      onRedirectToRelativeUrl: pushRelativePath,
      onRedirectToAbsoluteUrl: replaceAbsolutePath,
      })
      } catch (error) {
      // Handle error while closing browser tab.
      // Display message to user to close it manually
      }

      Parameters

      • formSubmissionResultOptions: {
            definition: Form;
            externalId: string | null;
            taskCompletion?: {
                redirectUrl: string;
                task: Task;
                taskAction: TaskAction;
                taskGroup: TaskGroup | undefined;
                taskGroupInstance: TaskGroupInstance | undefined;
            };
        }
      • options: {
            onRedirectToAbsoluteUrl: (url: string) => void;
            onRedirectToRelativeUrl: (url: string) => void;
        }

      Returns Promise<void>