After user makes screen inputs, I'd like to retrieve all Accounts and related Contacts (but ultimately just need Contacts) and use those retrieved Contacts to add said Contacts as Campaign Members on the campaign.
Basic understanding it to GET RECORDS (accounts), then loop through and add to a new collection variable.
But then how I do located related Contacts based on Accounts that were just put into the collection variable? Figured out how to do it in a loop using the AccountID = currentloopitem.id...but is there a way to NOT put the GET RECORDS (contacts) in a loop? SF keeps telling me to avoid this and move it outside of the loop, but how?
Process I'm using:
1. GET RECORDS - store all - automatically store all fieds
2. Loop through Account Collection Variable - assign current loop item to new Collection Varible
3. GET CONTACT RECORDS - repeat remaining steps
1 件の回答
Hi Ken 😊
It sounds like you are on the right path !
You are right that it's not a good idea to loop around many records in a Flow to avoid hitting Salesforce limits, however if you are looping around a handful of records you should be okay.
I would suggest the following high level;
- Create ALL Contact records using a Get Record and store all results
- Loop around the Contact Collection to add each Contact as a Campaign Member
If this has helped please be sure to mark as best.