• Joe Alian
  • 0 Points
  • Member since 2021

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2
We changed the list price of a product, and we don't want to enable sales people to still use the old price.
We dont allow changing the sales price (Profile permission) but this protects only creation of new opportunities.
If a user clones a previous record, the old prices remain.
How can I fix this?
I work in a company that our salesforce platform's architect follows SalesForce's trigger best practice to have a recursion check on Opportunity to stop the execution on each event independently. So the ExecuteAfterUpdate will run exactly once for each opportunity record. 
Here is my requirement:
1.  Apex class to have an API call to import Opportunity and OpportunityLineItems from another systme to Salesforce
2. Rollup OpportunityLineItems value to corresponding Opportunity value
3. Calculate OpportunityLineItems' value percentage= OpportunityLineItem Value/ Opportunity value.
Here is the implementation:
1. Apex class1 insert/update Opportunities
2. Opportunity Trigger is executed 1st time
3. Same Apex class1 then insert/update OpportunityLineItems
4. OpportunityLineItem trigger is exeucted 1st time and calls Apex class2 to rollup OpportunityLineItems value to Opportunity value, Opportunity is updated
5. Opportunity trigger is executed 2nd time and calls Apex class3 to calculate OpportunityLineItems' value percentage= OpportunityLineItem Value/ Opportunity value.
I am blocked in step#5, because Opportunity trigger is executed 2nd time, our company's trigger recusion check finds this Opportunity is already processed in step#2, it does not pass this Opportunity record to Apex class3.
My questions:
1. Is my implementation correct? 
2. Is company's trigger recursion implementation correct, because the same Opportunity record's value in step #2 and step #5 is not the same?
3. What should I do to bypass it?

thank you for the help.