0

My Salesforce flow retrieves campaign records and their corresponding campaign member records through a loop. The flow works correctly, but I encounter Apex CPU limit errors when running it with larger data sets. This issue appears to be caused by the Get Element within the loop.

To address this issue, I have researched collection filters, which can potentially eliminate the need for a Get Element within the loop. However, my understanding is that collection filters only reduce the number of records in a dataset.

Attached is a screenshot of my flow, including the Get Element. How can I implement a collection filter to avoid the Get Element within the loop?

enter image description here

3
  • 1
    A CPU timeout limit is something else entirely. You'll need to simplify your overall flow.
    – sfdcfox
    Apr 23 at 3:25
  • The flow isn't complex, I'm not sure I can simplify the flow anymore. My question is about how to remove the DML inside the loop and I'm trying to understand if using a Collection Filter will do that. Apr 23 at 6:50
  • You need to update you're question like what you're flow is actually doing In words & image, then only people here to check whether you're flow will effectively build or not. Currently you're attached flow only showing 60-75% image only.
    – Raj
    Apr 24 at 12:18

1 Answer 1

0

You can move your Get Campaign Members to before the loop and update the criteria so it gets every single Campaign Member in your org. Then inside the loop, use the Collection Filter to limit the collection based on the Campaign ID within the Current Item from Loop variable

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .