• JayTrades
  • NEWBIE
  • 0 Points
  • Member since 2013
  • Solution Architect
  • Bluewolf

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

Hello!

 

I have a pretty nice flow in place that allows a user to enter some useful competitor information when we lose an Opportunity. One of the steps in the flow allows the user to create a follow-up Opportunity for next year, which is designed to basically clone the existing Opp with all of its products.

 

To accomplish this, I created a query loop for Opportunity Product where a checkbox called "Flow Processed" is false (thanks @Rajaram! solution here: http://boards.developerforce.com/t5/Visual-Workflow/Deep-Clone-Opportunity-with-Products-via-Visual-Workflow/m-p/642189#M1419). The query retrieves each Opportunity Product one at a time, marks Flow Processed as true, clones it, and re-runs the query until there are no more Flow Processed = false products.

 

This works perfectly EXCEPT when there are a lot of products. My testing seems to suggest that 4 products is the limit. Anything over that causes this error:

 

caused by: interaction.sfdc.adapter.rules.SalesforceRuleBrokenException: UPSERT --- UPSERT FAILED ---  ERRORS :  (CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY) SL_Opportunity: System.LimitException: Too many SOQL queries: 101 ---  for SFDC record with ID : null, 

Salesforce Error ID: 497037844-218727 (-1473334608)

The SL_Opportunity referenced is a trigger developed by a third party that is essential to a system integration in place, so I can't really change that trigger. I need a different workaround.

 

I know some brilliant mind in this community can offer some suggestions for getting around this. I've been thinking about trying to count the number of Products and then separate the Product create actions into batches or something, but I keep getting confused!

 

Thanks!

  • September 25, 2013
  • Like
  • 0