Agentforce Marketing: leverage Upsert a Record for a Person

Tips from the Trenches #013
Discover how to use the built-in ‘Upsert a Record for a Person’ sub-flow in Agentforce Marketing to intelligently create or update Contacts, Leads or Prospects in your Form-Triggered Flow, step by step.

Create Record first Activity

When sending an Email in a Form Triggered Flow you need to add a Create Record as a First Element in the canvas, otherwise, you won’t be able to save it.

Form Trigerred Flows sending Emails need a Create Record as first Element

The message you get is:

This action is missing the following dependencies: The first element of the flow must either be a Create Records element or a Subflow element. If the element is a Create Records element, it must create a contact, lead, or prospect. If the element is a Subflow element, the referenced flow must have a “recordId” output..

The reason we get this message is that the Send Message Activity needs to ensure there is a Record in the Flow with an Email Address Field.

To get rid of that error, we can add a Create Record: Prospect, Lead or Contact as the first activity of the Flow.

Addind a Create Record (Lead) with the Matching option

We can now save the Flow. As we don’t want to create a new Lead if one already exists, we activated the Check for Matching Records option. You can specify any Matching Rules you like.

However, what if we want to create a Contact, if a Lead does not exist, for example? Using this architecture, we cannot do this. We’ll use a Subflow for this, and make sure to comply with the statement we gor earlier: If the element is a Subflow element, the referenced flow must have a “recordId” output.

The good news here, is that since the Winter ’26 Release, Agentforce Marketing (Marketing Cloud Next) offers us a predefined Subflow for this.

Upsert a Record for a Person

Not only will we be able to introduce a more elaborated logic to check for existing Records, but also, we will build a reusable subflow. Flows > New and search for Upsert a Record for a Person.

 

Creting a Upsert a Record for a Person Subflow Template

We select the Subflow template, and the Next, give it a name, then Save, and we have a starting point to handle the creation / matching of Prospect, Leads and Contacts.

Regular Upsert a Record for a Person Flow Template

The logic is very simple, and yet already powerful. First, let’s inspect the Variables of the created Flow.

Flow Variables: 2 inputs, 1 output

The Flow takes the Company and the Last Name as inputs and use these informations to check for existing Records. We will pass this informations when calling the Flow from our Form Trigerred Flow. The Flow returns a RecordId, which is what will be returned to and used by the calling Flow.

The logic is simple: update an existing Contact, if none is found, update an existing lead, if none exist, create or update an existing Prospect.

See this as starting point, for your own logic, and maybe add more input variables, like an Email Adress from the Form, etc.

Once you are done, Activate the Flow.

Using Upsert a Record for a Person

In our Form Triggered Flow, we will replace the first Create Record Element, and replace it with a our Subflow, so we remove it, and add a Subflow element and select the Flow you create above from the template.

Replacing the Create Record with our Flow created from the Template

Next we just need to pass the parameters the Subflow is expecting, we get their value from the Form which triggered the Flow (if you created more Variables above, define them too). Click the toggle next to Company, and then select Associated Form under Global Variables and select the Form Field containing the Company value. Do the same for lastName and the other Fields you may ave created.

Defining the Subflow input parameters from the posted Form Fields
There we have it, a custom logic to create or update Records using the Upsert a Record for a Person template to create a custom Subflow.

Be informed when we publish new content or have any questions? Join the TAM Slack workspace ↓

Share the Post:

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Join us on Slack

Your questions, answered.
Get our latest articles.