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
Katie LevyKatie Levy 

Create New Record on New Object Flow Help

Hi all, I'm trying to create a flow that looks at Object A, evaluates three fields, and creates a new record on Object B. A new record on Object B should only be created if there isn't already an Object B record with identical data in those three fields.

For example, Object A record has cat, dog, bird filled into the three fields, respectively. Create an Object B record if there isn't already an Objet B record with cat, dog, bird filled into the same three fields.

Is this possible? 
Alain CabonAlain Cabon
Hi,

When you don't use real relationships between the objects (lookup, master/detail) for the lookups precisely, it is a big problem for the performance and the governor limits for autolaunched flows used as batches when the flowss replace apex triggers.

Ideally, the three fields should joined into a single field as a new id (unique).

For a screen flow, there is no problem. Record lookup. Decision and Record create.

https://developer.salesforce.com/docs/atlas.en-us.216.0.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_designer_elements.htm

Record Lookup: Finds the first Salesforce record that meets specified criteria. Then assigns the record’s field values to individual flow variables or individual fields on sObject variables.

Flow Decision Element  Evaluates a set of conditions and routes users through the flow based on the outcomes of those conditions. This element performs the equivalent of an if-then statement.
 
Katie LevyKatie Levy
Thank you for the quick response! I created a field that joins the attributes into a unique value (catdogbird, to follow my example above). But when I choose a screen flow, I don't see record lookup as an element?
Alain CabonAlain Cabon
With the new Flow Builder, it is different from the Cloud Flow Designer indeed.

You are using the default Flow Builder that replaces the former Cloud Flow Designer.

Flow Builder vs. Cloud Flow Designer
https://help.salesforce.com/articleView?id=flow_builder_vs_cfd.htm&type=5 (https://help.salesforce.com/articleView?id=flow_builder_vs_cfd.htm&type=5)

Now it is simpler ( Create Records , Get Records ).

Your field that joins the attributes is a formula ?

A formula cannot be an Id (indexed).
Alain CabonAlain Cabon
Nevertheless, even if it is a formula field it is easier for the requests  ( myformulafield__c in ( <list of concatenated values> ))