Wednesday, February 6, 2019

Create a Workflow that Redirects the Page if Trigger is through the Standard Approve Button of Sales Order

There are several business processes that would require for a sales order to be fulfilled upon approval. We currently have a sample workflow that transforms a transaction and then redirects the user to the transformed record (Transform Record).

However, the Go to Record will not work if the trigger for the workflow was made by the Approve button. Below is an alternate solution to create a custom approve button for Sales Order.

Before we go to the workflow, below are the steps to check all the roles that has the permission to approve a sales order. These are roles that has the Sales Order Approval permission.

1. Create a Role Search. (Lists > Search > Saved Searches > New)
2. Add a Permission filter on the saved search.
 a. Permission is Sales Order Approval (anyof Sales Order Approval).
3. Preview or Save and Run the saved search.

Take note of the roles since it would needed on one of the conditions of the workflow.

Below are the steps to create the workflow.

1. Create a workflow. (Customization > Workflow > Workflows > New)

2. Use the details below on the workflow summary.

                a. Record Type: Transaction

                b. Sub Types: Sales Order

                c. Event Based - On Update

                d. Trigger Type - All

3. Create two states, State 1 and State 2.

4. On State 1, add a "Remove Button" action.

                a. Trigger On: Before Record Load

                b. Button Id: Approve

5. On State 1, add a "Add Button" action.

                a. Trigger On: Before Record Load

                b. Label: Approve and Fulfill

                c. Condition -

                                c.1 User Role = Administrator, Sales Executive... include all the other roles you were able to see on the search

                                c.2 Order Status = Pending Approval

6. On State 1> Transitions tab, add a new transition.

                a. To - State 2

                b. Transition On - After Record Submit

                c. Condition - Order Status = Pending Fulfillment

7. On State 1> Transitions tab, add a new transition.

                a. To - State 2

                b. Button - Approve and Fulfill

8. On State 2, create a state field by going to Field>New Field.

                a. Label: Fulfillment

                b. Type - List/Record

                c. List / Record - Transaction

                d. Store Value - Checked

9. On State 2, add a "Set Field Value" action.

                a. Trigger On - Entry

                b. Field - Order Status

                c. Value: Selection: Pending Fulfillment

                d. Condition - Order Status = Pending Approval

10. On State 2, add a "Transform Record" action.

                a. Trigger On - Entry

                b. Record Type: Item Fulfillment

                c. Store Result In - Fulfillment (State)

11. On State 2, add a "Go To Record" action.

                a. Trigger On - Entry

                b. Record Type: Item Fulfillment

                c. ID - Fulfillment (State)

                d. Edit - checked

No comments:

Post a Comment