function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DevWannabeDevWannabe 

Visual Flow to Update Record related to Connector Object

All of the following are custom objects except the Opportunity.  Opportunity, Quote, Quote Line Item, and Equipment.  Quotes are related to Opportunities, i.e. one Opp many Quotes.  Quote Line Item is a connector object between Quote and Equipment, i.e. Quote can have multiple pieces of Equipment and Equipment can be on mulitple Quotes.  Once a Quote is accepted all of the Equipment on the Quote Line Items need to be connected directly to a Quote, i.e. there is a lookup on the Equipment to the Quote that is empty until this time.  Any other Quote on the same Opportunity that has any Equipment connected through the Quote Line Item that was on the accepted Quote needs to be set to Canceled.  I have a flow that this actually works, but running into query limits as there are fast lookups within loops and loops within loops and trying to figure out a way around that.  Any help/guidance would be great.
GauravGargGauravGarg

Hi Dev,

Can you please share you code here. 

Thanks,

Gaurav

DevWannabeDevWannabe
Hey Gaurav,

There isn't any code, it is all in flows...
User-added image
GauravGargGauravGarg
Hi Dev,

Can you share your org credentials, there would be trigger logic which are getting executed everytime the record is created or updated. We need to limit the number of SOQL running in a single thread. 
The limit is 100 SOQL queries in a single thread.

Please contact me via email: gauravgarg.nmims@gmail or skype: gaurav62990

Thanks,
Gaurav
DevWannabeDevWannabe
Gaurav,

There isn't any code running on any of these objects.  It is just the flow that is running.  You can almost think of it as needing to collect all Contacts that are Members of a Campaign.  Meaning, I know the Campaign id and I want to update all the Contact that are connected to that Campaign through the Campaign Member object.  So, I am stuck on how to create the collection of Contacts from the collection of Campaign Members without doing a fast lookup inside of a loop.
GauravGargGauravGarg
Hi Dev,

I can see multiple looping within the visual flow, there are two options to remove SOQL error:
1. Divide the Visual flow in Workflow, process builder and visual flow i.e.
    In-case of field update / email alert / task we can create workflow rather than using Visual flow. 
    Divide Visual flow into process builder and visual-flow so that we can initiate multiple thread. 

2. Since visual-flow is the standard way of processing records at back-end we cannot control much on it, We can imlement trigger logic to control the flow of code. 
Within code we are able to control the number of queries fire in a thread or initiate multiple so that the Salesforce limit will not fire. 

Thanks,
Gaurav
DevWannabeDevWannabe
Hey Gaurav,

Looks like I will be moving this to a trigger...so will be looking into that.
GauravGargGauravGarg
sure Dev that s good move. Let me know if you need my assistance on this. 

Thanks,
Gaurav
Email: gauravgarg.nmims@gmail.com
​Skype: gaurav62990