by Taylor Pariseau
When using Tasks with QuickCreate turned on, users only have the ability to create a new Contact from the Name lookup field. Sometimes Contacts should be PersonAccounts. The process I spell out below will help you use the newest Salesforce features to convert an orphaned Contact into a PersonAccount. Utilizing the Process Builder and Headless Flows, we can accomplish this process without a single line of code! Here’s a step-by-step guide on how to do it:
Prerequisites
- Person Accounts turned on in your org.
- Understand that this process is intended only for contacts created as a single entry. It doesn’t work with a mass import of contacts.
Step 1 – Create the Headless Flow
This headless flow will control the functionality of the conversion. This is a three-step process, as you cannot create a Person Account without a related Contact.
- Variables
- sObject Variable
- Object = Contact
- Input and Output
- Usage: Used as a parameter. Process Builder will pass the Contact record in via this variable.
- Variable
- Type = Text
- Input and Output
- Usage: Will store the Account ID of the newly created Person Account
- Constant
- Type = Text
- Value = {Unique ID of desired Person Account record type}
- Usage: To store the ID of the Person Account Record Type
- sObject Variable
- First Element – RecordCreate
- Purpose = This element will create the new (non-Person) Account record
- Assignments
- Create = Account
- Fields = Enter any data from the Contact you wish to map to the new Account. I used Email, Full Name (formula field on Contact to put Name into single field), and Phone
- Assign the ID of new field the AccountID Variable created in Step 1.b
- Set this element as starting element.
- Second Element – Record Update
- Third Element – RecordUpdate
- Purpose = This element will update the Account to a Person Account by overriding the recordtype ID
- Filters
- Update = Account
- Fields = ID equals AccountID Variable created on Step 1.b
- Assignments
- Update the RecordTypeID field to the value of the Global Constant created on Step 1.c (image is hardcoded, not preferable)
- Connect and Activate
Step 2 – Create the Process
This Process will trigger to run anytime a Contact is created with Account=NULL.
- Process Start
- Object = Contact
- Start the process = Only when created (this is up to your business preferences)
- Allow multiple records in single transaction = False
- Action Group
- Criteria for executing actions = Filter conditions are met
- Filter Condition
- Field = [Contact.AccountID]
- Operator = Is Null
- Value = True
- TRUE Immediate Actions
- Type = Launch a Flow
- Flow = Select Flow created in Step 1
- Set Flow Variables
- sObject Contact = [Contact]
Finally, Activate and test it out!