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
Alex Waddell 17Alex Waddell 17 

Remove Duplicates from sObj Collection - Fast Lookup

Hello,

I am trying to create records using flow for every Account that has an Invoice__c in a certain period...

The Invoice__c object is a child of the Account so there can be many invoices for an Account in any given period

The problem I am running into is when I Fast Lookup Invoices__c for a given time period and tell the system to store the Account Id's for those invoices in a Collection Variable IF an Account has 3 Invoices for a period it will store the Account ID 3 times

So when I tell the system to create a Correspondence__c record for every Account ID, I am creating 3 records for a vendor when I only need 1... How can I tell Flow to only store a value if the value is not currently in the Collection set?

Below is a picture of my Flow:
User-added image
Gaurav HandooGaurav Handoo
Hi Alex

This can be done with certain modifications in your flow. However, you might want to consider the fact that given Invoice__c is a child object of Account, you can roll up the latest Invoiced date on Account and then instead of Quering on Invoices, you can query on Accounts and then proceed further.

Hope this helps. Please mark as best answer if it does.

Cheers!!

Gaurav