+ Start a Discussion

Problem with Workflows and Triggers


we have a problem in our company that i dont know how to resolve.

Step 1: We have to modify a field in all the new lead that comes, its working.

Step 2: This modification will fire a trigger that create documens asociated to the lead,

working but when are more than 10 documents the next error fire: "Too many SOQL queries: 21"


Then next step work but only if we do it throught a independient workflow but we dont know how to do that the last trigger do it: 


Step 3: We need that the process create 4 based timed WorkFlows that will send an email to the lead, working.


WF Process



Any suggestion??

Thanks a lot


Step 2: you probably have your SOQL statement inside a loop.

Their point *is* to put it inside a loop (so to speak).  So I'm not sure why attaching a document is causing two SOQL queries.  You must be doing something a tad strange there.  I can understand one SOQL query per document.  Maybe you can show us a sample of the trigger code?


I see no issue with doing step 3 as an indepenant workflow.  Have the trigger do something that fires the workflow.  That seems fine.