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
Angela CunvinAngela Cunvin 

Opportunity Approval Process Defined by Field on Opportunity Product Object

We have 3 managers that need to approve opps based on a custom formula field (Product_Sub_Type__c) we've added to the opp prod object, but the approval process workflows/rules don't allow fields from the opp prod object to be used. Is there a trigger I could create to help create an approval process that would allow us to send to an approver based on the product sub types in an opp? I was informed by Salesforce Helpdesk that a trigger could be the answer, but I don't know where to start, so if you could point me in the right direction or provide an example of a trigger that could work, that would be very much appreciated. Thanks!
Kiran RKiran R
Kiran R
I am sure there might be a strong case for using the trigger here but i am not able to see it from the requirement stated above.

However, Before creating a Trigger, I would try a cross-object formula field on the opportuniy to repllicate the Product_Sub_Type__c's formula and key-off my approval process to decide the approver/manager using the new formula field created on the opportunity.

I am sure you must be familar with this. But, Sharing in case if you find this useful about creating cross-object formula fields:
https://help.salesforce.com/HTViewHelpDoc?id=fields_creating_cross_object_advanced.htm&language=en_US

Even if that doesn't work, I don't see how a trigger can help unless you are replicating the Product_Sub_Type__C functilnality in that trigger which can be acheived by creating cross-object formula field (like, described above). Since, formula doesn't store any value. Formula is executed only when you retrieve it, We can not copy that value into opportunity using trigger.

Angela CunvinAngela Cunvin
Hi Kiran,

I had thought it was that easy too, but it's not :( It's simply not possible to create a formula field on the opportunity that pulls information from the opportunity product object, because a user can add multiple product line items to one opportunity and each line item product will/may have a different product sub type, so some serious code would have to be written to add multiple formula fields dependent on the number of line item products to be able to create this cross object formula field solution.

Thanks for responding though, I appreciate it.