function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andrew Hoban 14Andrew Hoban 14 

Updating the Quantity Sold field with a Workflow rule

Hi,

I was wondering if its possible to update the quantity sold field when certain criteria is met. I have created one and for some reason it does not seem to trigger. I have attached an image of the workflow i have created. When a product is added to the opportunity i want the quantity to availibility to decrement by 1.

Many thanksUser-added imageUser-added image
RishavRishav
Hi Andrew,
                    since you are dealing with two object and the workflow is always used for single object. If you use the field update the it will work with the object 
                 on which workflow has written.
              According to my thinking you need to write the trigger .  Write the After trigger on the opportunity trigger and check that if the current opportunity is having  any product if yes then find out the number and  then decrease that number from the total number of product from PRODUCT object.

Thanks
Rishav
Andrew Hoban 14Andrew Hoban 14
Hi, thanks for the quick reply,

This seems correct, however would i write the trigger on opportunity or opportunityLineItem

Many thanks