• Ernest Fullerton
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All,

My salesforce org has multi-currency enabled.  We have a separate PriceBook (not separate entries in the same PriceBook) for all of our regions.  
 I have a custom object Professional_Services__c that is the child of Opportunity.  I have built a flow using the Process Builder that inserts/updates an OpportunityLineItem whenever a  Professional_Services__c object is inserted/updated.  

The PriceBookEntryID of the OLI will vary based on the PriceBook associated with the Opportunity (e.g. OLI will have a GBP PricebookEntry if Opportunity Pricebook is GBP, USD PricebookEntry if Opportunity Pricebook is USD).  
User-added image
The obvious problem here is that currently I'm forced to hardcode the PriceBookEntryID.  So when I migrate this process to production, I would have to change the PriceBookEntryIDs to those in Production which would be annoying but not showstopping.  The showstopping part is that this breaks my tests, which I need to migrate to production.  The tests generate PriceBooks, PriceBookEntries, etc. to prevent all of the pitfalls of using the (SeeAllData=true) annotation.  Is there any possible way to dynamically reference the PriceBookEntryID in the Process Builder?

As a side, because of the order of execution, I cannot accomplish this task using triggers, as relevant values from roll-up fields wouldn't be populated.

Thank you all in advance for your time,

Max