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
  • 0
    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.

Reply
  • 0
    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.

Children
No Data