+ Start a Discussion
Alison Chambers 2Alison Chambers 2 

Visual Flow: how to continue after no records are found?

I'm trying to look for a specific product code in an Opportunity Line item.  If I find it, I'll update a flag to true on the Opportunity.  If I don't find it, I'll update the flag to false.

However, when I don't find it, the flow fails.

Is there a way to capture and handle this so I can continue to my Record update?

Things I'ved tried:
Set the variable values to null when the Opportunity Line Item record is not found.
Create a fault line in addition to the regular process line from the Record Lookup element to the Decision element.
Best Answer chosen by Alison Chambers 2
anto nirmalanto nirmal
Hi Alison,

As I understand the problem statement is:
Update parent record based on the child records availability.
Correct me if I'm wrong.

Can you please try out the following solution?
1) I assume you should have a flow variable with the Opportunity Id.
2) Create an SObject variable for Order Line Items
3) Create a Fast Lookup to fetch the order line items into the new SObject variable. This should be filtered with the opportunity Id.
4) Create a Loop step on the SObject variable to loop through the order line items records fetched.
5) Have a decision step in the next element to check if the order line item falls in the business scenario.
6) If yes then have an Assignment step to update a flag variable.
7) Out of the loop, have a decision to check the flag variable 
8) If the flag variable is true update the opportunity with a Record Update

Please let me know if the helps.

As a common practice, if your question is answered, please choose 1 best answer.
Additionally you can give every answer a thumb up if that answer is helpful to you.

Regards,
Anto Nirmal
 

All Answers

anto nirmalanto nirmal
Hi Alison,

As I understand the problem statement is:
Update parent record based on the child records availability.
Correct me if I'm wrong.

Can you please try out the following solution?
1) I assume you should have a flow variable with the Opportunity Id.
2) Create an SObject variable for Order Line Items
3) Create a Fast Lookup to fetch the order line items into the new SObject variable. This should be filtered with the opportunity Id.
4) Create a Loop step on the SObject variable to loop through the order line items records fetched.
5) Have a decision step in the next element to check if the order line item falls in the business scenario.
6) If yes then have an Assignment step to update a flag variable.
7) Out of the loop, have a decision to check the flag variable 
8) If the flag variable is true update the opportunity with a Record Update

Please let me know if the helps.

As a common practice, if your question is answered, please choose 1 best answer.
Additionally you can give every answer a thumb up if that answer is helpful to you.

Regards,
Anto Nirmal
 
This was selected as the best answer
Alison Chambers 2Alison Chambers 2
Thank you, Anto.