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
Admin3 RadiusAdmin3 Radius 

Determining Lacking records in Flow

In flow, I would like to get a records from an object and check from an array(or an alternative) if such match exist then for those that does not exist, I need to create that records with predetermined values. So here is my sequence:
1. Fetch records for object A with filter user and year
2. from the result with perhaps an array? (January~December - as text) determine which value have no match.
3. From the list of non existing record, iterate on array with missing Month and create those records with default values.
 
I dont know how to implement or create the flow for Item 2 & 3.
Any experts help is greatly appreciated. Thank you in advance.
Best Answer chosen by Admin3 Radius
Shri RajShri Raj
There are also other ways to implement this but, 
Start with a "Record Lookup" element to fetch records from object A, with a filter to retrieve records for a specific user and year.
Create a "Loop" element to iterate through the list of records returned in step 1.
Inside the loop, create a "Decision" element to check if the current record's month value matches any of the values in your array of months (January~December). You can use the "Contains" element to check if the current record's month value is contained in your array.
If the current record's month value does not match any of the values in your array, create a new record in object A using the "Create Record" element. You can use the "Assign" element to set the default values for the new record.
If the current record's month value does match a value in your array, continue to the next record in the loop.
Once all records have been processed, the flow will exit the loop and continue with any subsequent elements you have in your flow.

All Answers

Shri RajShri Raj
There are also other ways to implement this but, 
Start with a "Record Lookup" element to fetch records from object A, with a filter to retrieve records for a specific user and year.
Create a "Loop" element to iterate through the list of records returned in step 1.
Inside the loop, create a "Decision" element to check if the current record's month value matches any of the values in your array of months (January~December). You can use the "Contains" element to check if the current record's month value is contained in your array.
If the current record's month value does not match any of the values in your array, create a new record in object A using the "Create Record" element. You can use the "Assign" element to set the default values for the new record.
If the current record's month value does match a value in your array, continue to the next record in the loop.
Once all records have been processed, the flow will exit the loop and continue with any subsequent elements you have in your flow.
This was selected as the best answer
Admin3 RadiusAdmin3 Radius

Hi Shri,


Thank you so much for your response. I think this is a great idea, however I took a different approach.
Since I need to assign IDs on specific fields of the records from the initial source, I created a variable for each month which holds ID of a template for the assigned months. Then on the create records, I assigned those variables on their respective fields

User-added imageUser-added image
I have time constraint on creating this type of records so I will try your approach once I got a plenty of time.
Also, I am new on the Collections variable as an array, I still dont know how to assign/access each elements.
But with your approach I know the flow will be far more optimized.


Thank you so much for your response and answer.