Scenario
The client is creating a sales order from the customer record > Quick action> Sales order. while creating sales order like this client want to set a specific custom form for this particular customer.
Solution
Go to customization> Workflows > Workflow> New
Record Type: Transaction
Sub Type: Sales Order
Event Defenition
On create
Click save
(No need to give conditions in the workflow)
State 1
New Action> Set field value
Trigger on: Before User edit
Triggering Client Fields: Select Customer
select the field> Form
static value as the name of the custom form
Condition
- Field: Select Customer
- Compare Type: Select any of
- Selection: Enter the name of the customer
- Click Add
- Field: Select Custom Form
- Compare Type: Select none of
- Selection: Enter the name of the custom form
- Click Add
- Click Save
Add new Action Set Field Value
Trigger on: After field edit
Triggering Client Fields: Select Customer
select the field> Form
static value as the name of the custom form
Condition
- Field: Select Customer
- Compare Type: Select any of
- Selection: Enter the name of the customer
- Click Add
- Field: Select Custom Form
- Compare Type: Select none of
- Selection: Enter the name of the custom form
- Click Add and Save
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. Also, when creating Sales Orders or Cash Sales from the Sales tab of the Customer record, the relevant fields for the customer are being sourced when the form is loaded, this creates a quick refresh on the page. Because of this, Before User Edit is triggered every time the page refreshes. To exit this action, the transition from the first state to the second state is created.