Monday, July 1, 2019

Different behavior of a Workflow's Set Field Value Action in the UI vs. Online Forms

In the described scenario a workflow is used on a custom record to set a field's value during the Before Submit event according to the value set on a different field. For example, a record contains a field of type List/Record with List/Record: Customer and a second field on this custom record is supposed to be updated by the workflow to the selected customer's email address.

In order to achieve this behavior a workflow action with the following setup is used:

  • Type: Set Field Value
  • Trigger On: Before Record Submit
  • Field: custom field which should be set by the workflow
  • Value: From Field
    • Record: Customer
    • Field: Email

Testing the workflow action results in correct behavior for tests performed in the UI, but the field is not set for tests performed from an online form. For the tests performed from the online form, the workflow log shows that the action has been performed but the value provided is null.

The reason behind this behavior is that the workflow is not set to Execute as Admin. Without this setting, the workflow executes as the current user and since the online form user does not have the necessary permissions to access the customer record, the value of the email field is returned as null. More information about the needed access to related records when running a workflow can be found in SuiteAnswers : Who Can Run a Workflow? (Article Id: 11571).

If the Execute as Admin checkbox on the Workflow Summary page is checked, the action will successfully set the value from the related record from both UI and online form.

No comments:

Post a Comment