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
Matt EckMatt Eck 

Update/Create record in login flow

Hey Everyone,

I'm trying to create a login flow that will update a record whenever a person logs in, or create one if it doesn't already exist. I have it working right now so that whenever someone logs in it will create a new record, but I can't figure out a way that I can check to see if a record already exists and then choose to update or create the record based on that. Is their any way this can be done in a login flow? 

Any help would be really appreciated.
Thanks!
Best Answer chosen by Matt Eck
Rakesh51Rakesh51
Let's say you want to create Lead record based on email

1. Use Record Lookup element on Lead object to find if lead exists with email abc@salesforce.com. Store the record id in a variable {!RecordId} 
2. Use Decision element to check the variable size
3. If record not exists then create one 

I found this article helpful ​https://automationchampion.com/2015/08/22/getting-started-with-process-builder-part-42-auto-remove-a-record-from-chatter-groups/

All Answers

Rakesh51Rakesh51
Let's say you want to create Lead record based on email

1. Use Record Lookup element on Lead object to find if lead exists with email abc@salesforce.com. Store the record id in a variable {!RecordId} 
2. Use Decision element to check the variable size
3. If record not exists then create one 

I found this article helpful ​https://automationchampion.com/2015/08/22/getting-started-with-process-builder-part-42-auto-remove-a-record-from-chatter-groups/
This was selected as the best answer
Matt EckMatt Eck
That worked great thanks for the help! I thought it must have something to do with the record lookup but I couldn't figure it out.