I have build a flow, the flow executes without any error. But it doesnt do what its supposed to do. I am pretty new to Flows and its my first attempt as it.

Here is what the flow is supposed to do When a lead comes in then, it checks in Account if there is an Account if the website domain matches with the email domain of the lead. If it finds an account then reassigns the owner of the lead to the owner of the Account.

I am not sure how to debug the flow.

Here is my Flow enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here


Based on the conversation happened on twitter (Simplified version of your flow)

enter image description here


1) Your loop doesn't go full circle. You can draw another connection from the assignment element 'assign boolean if found match' and the loop element 'LoopAccount'. Because there is no connection back to the loop element it in effect isn't a loop, and the flow ends after the assignment element. (I would suggest using an extra assignment element as a place holder to make a loop an actual loop. Because an assignment element requires a variable, you'd need to create an empty variable just for that.)

2) If you have made sure in advance that every domain only exists once in your database, then you probably don't need to loop over any elements. You can simply put all the accounts in an s-object variable (instead of an s-object collection variable). The fast lookup will than put the first one it finds into the s-object variable. After that you can then use that decision to check if the variable is empty.

I hope that helps you.

  • Ah! that makes sense now... – Prady Jul 23 '15 at 15:00
  • is there a way to debug as to what each variable holds in Flow – Prady Jul 23 '15 at 15:18
  • 1
    Yes, but it's not super easy. The easiest way i know is to to put screens in between each step, and display your variables on the screens. This guy wrote a great blog post on it: salesforceyoda.com/2014/05/06/… – Kasper Jul 23 '15 at 16:49

To add to the above, you need to be assigning more (ie the owner portion) within your Loop. If you are looping through your collection to add a bunch to the "pile" to update, then your ONLY step outside the Loop would be the DML statement, which would be an Update Leads element. You would take the collection of Leads you have assigned within your loop and perform one update of the whole collection.

I think it is wise to keep it as a Loop/Collection because there may be times when a large import of Leads is done, and this keeps it bulkified.

  • Sure.. excellent point :) – Prady Jul 23 '15 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.