Get Unique Records (Excluding Duplicates) - Flow Designer

Vinay52
Tera Expert

Hello, 

I have a custom table and get the records created in one day and i would like to exclude the duplicates and get only unique records. 

Ex - Table 1

User IDNumberStatus
Mike1 
John2 
John3 
San4 
John2 

 

Here John has 2 entries where User ID and Number are matching. I would like to get 4 Unique records excluding 1 record of John and update that record as Duplicate. 

 

I tried to use "look up records" with the condition of created in one day and then "For Each" with Transform Function - Unique by Name or Number - Utilities transform functions to get the unique but not getting the result. 

 

Any other ideas? Thank you

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @Vinay52 ,

There is no OOB way to get unique records using Lookup records action. And, the utilities transform applies on array elements not on complex objects. One way is to implement a custom script to get the unique records or the flow designer itself, but the complexity will be O(n^n).

 

For example, I designed a simple flow for demonstration purpose, which finds the users and search for duplicates based on name and email fields.

AnveshKumarM_9-1680866414806.png

 

1. Get all users created in last 24 Hours and active.

AnveshKumarM_1-1680865853942.png

2. Iterate through each record.

AnveshKumarM_2-1680865943658.png

 

3. Find all the records with same name and email ID using lookup action

AnveshKumarM_5-1680866228455.png

 

 

4. If the records count is greater than 0 make other records in active.

AnveshKumarM_6-1680866255001.png

 

 

5. Update the records to in active excluding the first record using for each and update record.

AnveshKumarM_7-1680866304081.png

AnveshKumarM_8-1680866350075.png

 

 

Mark this answer Helpful 👍/  Accept solution ✔️if helped you resolve your issue.

 

Thanks,

Anvesh

Thanks,
Anvesh

View solution in original post

6 REPLIES 6

AnveshKumar M
Tera Sage
Tera Sage

Hi @Vinay52 ,

There is no OOB way to get unique records using Lookup records action. And, the utilities transform applies on array elements not on complex objects. One way is to implement a custom script to get the unique records or the flow designer itself, but the complexity will be O(n^n).

 

For example, I designed a simple flow for demonstration purpose, which finds the users and search for duplicates based on name and email fields.

AnveshKumarM_9-1680866414806.png

 

1. Get all users created in last 24 Hours and active.

AnveshKumarM_1-1680865853942.png

2. Iterate through each record.

AnveshKumarM_2-1680865943658.png

 

3. Find all the records with same name and email ID using lookup action

AnveshKumarM_5-1680866228455.png

 

 

4. If the records count is greater than 0 make other records in active.

AnveshKumarM_6-1680866255001.png

 

 

5. Update the records to in active excluding the first record using for each and update record.

AnveshKumarM_7-1680866304081.png

AnveshKumarM_8-1680866350075.png

 

 

Mark this answer Helpful 👍/  Accept solution ✔️if helped you resolve your issue.

 

Thanks,

Anvesh

Thanks,
Anvesh

Hello Anvesh, 

How do i exclude the first record? Its making In active all records which are duplicate, I would want to exclude one record

Hi @Vinay52 ,

Just change the if condition in step 4 to greater than 1.

 

Thanks,

Anvesh

Thanks,
Anvesh

Hey @AnveshKumar M ,

I have tried it already and seems If Duplicate Found is running for all matches and making all 3 records In Active. 

Did it work for you?