Sunday, April 14, 2019

Create Sales Order/Cash Sale from Customer Record and Set Preferred Transaction Form Based On Customer's Subsidiary

When customers are assigned to a specific subsidiary, the users can create a custom form to reflect the correct subsidiary's address. With this concept in mind, users can create a workflow to set the desired form when creating a Sales Order or Cash Sale, in this workflow the creation of the Sales Order or Cash Sale is done from the Customer record under the Sales tab.

Perform the steps below to create the workflow:

1. Create Workflow
Name: Change Custom Form
Record Type: Transaction
Sub Types: Cash Sale, Sales Order
Release Status: Released
Enable Logging: True
Initiation:
On Create: True
On Update: True
Trigger Type: - All –

2. Create State 1

3. Create First Set Field Value Action
Set Field Value
- Trigger On: Before User Edit
- Field: Custom Form
- Value:
  -Static Value: Selection = (Custom Cash Sale Form)  
- Condition: Subsidiary (Main) any of(Select Subsidiary) 

4. Create Second Set Field Value Action
Set Field Value
- Trigger On: Before User Edit
- Field: Custom Form
- Value:
  -Static Value: Selection = (Custom Sales Oder Form)  
- Condition: Subsidiary (Main) any of (Select Subsidiary)

5. Create State 2

6. Create Transition from State 1 to State 2
- Condition: Custom Form any of (Custom Cash Sale Form), (Custom Sales Order Form) 

To test the workflow, open a Customer record and navigate to the Sales tab, click New Sales Order, when the Sales Order form loads, the Custom Form field changes to the desired form as defined on the workflow. The same behavior applies when clicking the New Cash Sale on the Sales tab of the Customer record.

POINTS TO CONSIDER

- Before User Edit is used instead of Before Record Load since the action has finished loading the Customer's info from the server. The processing of the record is now on the client side, thus Before User Edit is used.

- When creating Sales Orders or Cash Sales from the Sales tab of the Customer record, the relevant fields for the customer is being sourced when the form is loaded, this creates a quick "refresh" on the page. Because of this, Before User Edit is triggered everytime the page refreshes. To exit this action, the transition from the first state to the second state is created.

No comments:

Post a Comment