I have created a workflow on the Order Line Item object that fires when a custom field named Customer Budget is Changed. I have added 3 field update actions under this workflow rule.

  1. To update a Custom field named Remainder Quantity
  2. To update a Custom field named Remainder Amount
  3. To update the standard Quantity field.

The User enters a value to the Customer Budget field, and that value will be divided by the value in the Standard Unit price field. And whatever the value we get by that function will be updated in the Standard Quantity field i.e that 3rd field update action that I have mentioned above.

After the Quantity is updated, the Total field will be auto-calculated with the logic of Unit UnitPrice * Quantity. The difference between the Customer Budget field and the Total Price field is updated in the Remainder Amount field using the second field update action.

The first update action just checks if the difference between the Remainder amount and customer budget field is positive and updates the Remainder Quantity field.

My problem here is when I enter the Customer Budget as 1350. The field values are as mentioned below.

Customer budget = 1350
Unit Price = 45
Quantity => 1350 / 45 = 40
Total price = 1350
Difference between Customer Budget and Total price = 0

But even though the difference is 0, and the same should be updated in the Remainder Amount, I am seeing the value of 765.

The formula that I've used to update the Remainder Amount is as below. I have used Quantity * UnitPrice because I couldn't reference the Standard Total price field. And I had to use the logic of it instead.

Customer_Budget__c - (Quantity * UnitPrice)

I am not sure why this is happening, Is it because the three field update actions are firing randomly instead of in Order? If yes, how can I go around this? can anyone please help me with this? Thanks in advance. Also, please let me know if further clarification is needed for this.

  • All 3 field updates will execute in a single transaction on OrderItem if they are part of the same workflow rule
    – cropredy
    Commented Oct 2, 2021 at 4:36

1 Answer 1


Actually I don't think. You need Workflow rule for this. Hope you can get Customer_Budget__c and Unit Price values via manually. So Please use formula function to achieve this,

For Quantity field formula will be,

Customer Budget / Unit Price

For Total field formula will be,

Quantity * Unit Price

For Remainder Amount field formula will be,

Customer_Budget__c - Total price

For Remainder Quantity field formula will be,

IF ((Remainder Amount - Customer_Budget__c) > 0, Remainder Amount - Customer_Budget__c, 0)

Please let me know if it helps.

  • Thank you for the response. But these fields should be editable. Making them as formula fields will make them not editable, isn't it?. Commented Sep 29, 2021 at 10:50
  • Yes, But actually I thought, these fields are not need any Editable functions. Since as per you're requirement, These fields are calculating something from Unit Price & Custom budget field values. But anyway let me wait other answer as well.
    – Raj
    Commented Sep 29, 2021 at 10:58
  • Sure. Thank you. Commented Sep 29, 2021 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .