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

Help with opportunity/opp.-product workflow needed

Hi all,
the problem is as follows:
I need to set up a workflow that creates two tasks if these rules match:
- opportunity stage has a certain value
- The opportunity has at least one product with a certain "product code"
Now our internal work procedure requires us to first add new products to the opportunity and then switch the opportunity stage to the desired "trigger value" that should fire the workflow.
Option A:
Chose "Opportunity" as workflow trigger object. The show stopper is that its not possible to use opportunity products in the workflow rules - their fields are simply not listed in the dropdown lists.
Option B:
Chose "Opportunity Product" as workflow trigger object. Now you can set up all rules fine. The "oops" comes when you try to fire the new workflow by creating an opportunity that matches both rules mentioned above.
If you set the opportunity stage to the right value and after that add one matching product, all works perfect - but this just isn't the way we work. If you do it the other way around (select the product and then set the opportunity stage), the workflow won't be fired at all...
Any ideas on this one?
It doesn't sound like standard workflow can satisfy your requirements, but assuming you have Apex available, a trigger on the Opportunity could easily check for the existence of a certain product code in the line items and add the tasks.    

i would add a formula field to the opportunity product that Identifies if it is one of the products you are specifying. If it is then the formula equals 1 otherwise 0.


On the opportunity, have a rollup summary field that counts this custom formula field on the opportunity product.


The workflow then fires if the roll-up summary field >0