Screen flows are an absolute game changer outside of programmatically creating custom interfaces for creating records. Screen flows offer an easier level of accessibility to admins and developers alike. They can replace related records “new” button to add multiple opportunity products.
So in the scenario, we will cover one of the most common use cases. Creating contacts on an account instead of just replacing the new contact functionality. We are going to add a little more flavor to it. By checking if it has a partial match in the system we will be able to see this by checking both the phone and the email. with the chance to update an existing record instead.
Create Contact Screen
We need the following fields for a contact.
- First Name
- Second Name
- Phone
Create Record Variables
Assign variables with the same name for readability like FirstName and LastName on the create. This is the simple method of creating a contact on the flow. We will be building this out further and will including do we will add checking of Phone and Email in Salesforce on existing contacts. See below how I’ve laid it out this works for me but you may want to play about with it.
Matching Screen
So we will create a record choice set setting Contact as the object. But before we do this if we create a formula on a contact that displays First Name, Surname, Email, and Phone in one field. Next, we will select OR statement on the criteria and check the phone and email against the phone and email fields you filled out on the screen. Now select the formula field as the choice label. Next to the value select the record id.
We will create the screen which will display matched/partially matched numbers and email addresses, I have added some text as instructions for the user this is entirely optional but will look more complete. You will need to add two picklists one for Existing Contacts that Match using the record choice set and a second picklist to which you will add three choice variables add them to the second picklist as Edit Record, Create Record, or End Flow.
Next, try it out because we aren’t making any commitments to the database. What I did was create two contacts with phone and email then run the flow and put in the phone number from one of the records and the email second and this will now display two records under “Existing Contacts That Match”. It should look like the one below.
Now that is all working we will continue and conclude this in the second part here.