I've a use case where in I need to check that if a sales order is for a specific subsidiary, and a custom field is selected, then I need to calculate the discount percentage on the order total and populate under Discount Rate.
For this I have a saved search on sales order,
Criteria:
Type = Sales Order
Subsidiary = US-1
Main Line = True
Results:
Date - Group
Amount
Formula(Currency) - Maximum = CASE WHEN {subsidiary.id} = 7 AND {custbody_discount_program} IS NOT NULL THEN -1 * ({fxamount} * {custbody_pcg_lvl_1_disc}) ELSE 0 END, Custom Label = Discount Rate
This saved search correctly shows calculated the discount amount.
I then have a workflow on sales order for US-1,
Workflow:
Record Type= Transaction (Sales Order)
Release Status = Testing
Initiation = Event Based
Events = On Create, On View Or Update
Trigger Type = All
Condition = Subsidiary(Main) = US-1
Action: Set Field Value
Trigger On = Entry
Field = Discount Item
Value:
Static Value = Cash Discount
Action: Set Field Value
Trigger On = After Record Submit
Event Types = Create, Edit
Condition = Discount Program is Not Empty And Date<=Discount Program: Quote End Date And Discount Item is Not Empty
Then in the Field, I've selected Discount Rate and From Field = Current Record, Field = Discount Rate
When I create, or edit the sales order, I see that the Cash Discount item populated on the discount item field but the discount rate field is not getting updated.
Any help would be appreciated,
Thanks,
NSPK