Tuesday, October 23, 2018

Set/Unset a field as mandatory via the Workflow Manager

 

This article shows how to set a field as mandatory, if another field's value satisfies a certain condition, and unset the field as mandatory, if the other field has not satisfied the condition anymore.

1. Create a new workflow by navigating to  Customization > Scripting> Workflows > New

2. Define the workflow
    a. Name = Set Unset Field as Mandatory
    b. Record Type = Transaction
    c. Sub Types = Sales Order
    d. Release Status = Testing
    e. On Create = TRUE
    f. Trigger Type = All
    g. Click Save.

3. Click State 1. Edit it and set Name = Mandatory or Not. Click Save.

4. To add an action to the state, click New Action.

* This action will set another field as mandatory if a specified condition is met.

    a. Select Set Field Mandatory.
    b. Trigger on = After Field Edit
    c. Client Fields = Department (Main)
    d. Condition = Department (Main) Is Not Empty
    e. Field = Class (Main)
    f. Mandatory = TRUE
    g. Click Save.

* This action will unset another field as mandatory if a specified condition is not met. This ensures that the other field will not be set to mandatory once the user changes the selection or enters a new value on the 'changed fields' and it did not meet the criterion.

    a. Select Set Field Mandatory.
    b. Trigger on = After Field Edit
    c. Client Fields = Department (Main)
    d. Condition = Department (Main) Is Empty
    e. Field = Class (Main)
    f. Mandatory = FALSE
    g. Click Save.

These steps are also applicable when using the Set Field Display Type and Set Field Value actions.

No comments:

Post a Comment