Show Error Message on User interface when process on create record action fails

Certified Associate Developer

I need to Show Error Message for the user in the User interface when process on create record action fails. Currently it just says 'Action completed' whether the process is success or failure. User is unable to know if the record is successfully created or not.


  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    If you are calling process from record action or related action.
    To show custom error messages when a record action fails, prevent the default "Action completed" message from appearing by ending your process with a chained User Input Task instead of an End node. After your Write Records node, add an XOR gateway to check success/failure and store the result in process variables. Enable activity chaining from Start through all critical nodes to the final User Input Task, which displays an interface showing either "Record created successfully!" or your specific error message based on the process variables. Since the process ends with a user interface rather than completing normally, the generic "Action completed" message won't appear, and users will see your meaningful feedback instead.

    If you are calling process from interface,
    When using a!startProcess() to call a process from an interface, you can directly handle success/failure using the onSuccess and onError parameters.

    a!startProcess(
      processModel: cons!YOUR_PROCESS_MODEL,
      processParameters: {record: ri!record},
      onSuccess: {
        a!save(local!message, "Record created successfully!")
      },
      onError: {
        a!save(local!errorMessage, "Error: Failed to create record")
      }
    )


    Then display local!message or local!errorMessage in your interface using components like a!sectionLayout or a!boxLayout with conditional visibility. For the error details to be meaningful, ensure your process model captures specific error information in process variables, which you can access through fv!processInfo.pv in the onSuccess parameter to show more detailed messages.

  • 0
    Certified Associate Developer
    in reply to Shubham Aware

    Thanks for the reply  But, when the Write Records node fails, the process aborts and doesn't proceed further right? How can we then call this UI for showing the error to the user?

  • 0
    Certified Lead Developer
    in reply to Sreeram

    You're right - when Write Records actually fails, the process pauses by exception and never reaches your XOR gateway or User Input Task, so custom error messages are impossible. The XOR approach only works when Write Records succeeds but returns something you want to check (like 0 rows affected). For true failures, users will see "An error occurred" (not "Action completed").
    Workaround: Use a subprocess to wrap your Write Records node. In the main process, call this subprocess with "Pause on Error" set to false. After the subprocess call, check if it completed successfully using process analytics or a flag variable. Based on this check, route to your custom error message UI. Alternatively, validate all data thoroughly before Write Records to prevent failures, and use Write Records outputs (like rows affected) to determine success rather than relying on exceptions.

  • 0
    Certified Associate Developer
    in reply to Shubham Aware

      I created an exception with rule to see if there is error and then redirect it to a user interface. But his User Interface doesn't pop up, but when I see the instances, it has gone to the User Input Task and is waiting at that task.

  • 0
    Certified Lead Developer
    in reply to Sreeram

    Exception flows break activity chaining. When Write Records throws an exception and flows to your User Input Task, the record action loses its context and can't display the UI automatically. Instead, the task sits in the user's task queue.
    A better approach is the subprocess method mentioned earlier - wrap Write Records in a subprocess that catches errors and returns normally to the main process, maintaining the activity chain throughout.

Reply
  • 0
    Certified Lead Developer
    in reply to Sreeram

    Exception flows break activity chaining. When Write Records throws an exception and flows to your User Input Task, the record action loses its context and can't display the UI automatically. Instead, the task sits in the user's task queue.
    A better approach is the subprocess method mentioned earlier - wrap Write Records in a subprocess that catches errors and returns normally to the main process, maintaining the activity chain throughout.

Children