Using Process Builder to Convert Contacts into Person Accounts

April 21, 2015 Appirio

by Taylor Pariseau

techbl
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

  1. Person Accounts turned on in your org.
  2. 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.

  1. Variables
    1. sObject Variable
      1. Object = Contact
      2. Input and Output
      3. Usage: Used as a parameter. Process Builder will pass the Contact record in via this variable.
    2. Variable
      1. Type = Text
      2. Input and Output
      3. Usage: Will store the Account ID of the newly created Person Account
    3. Constant
      1. Type = Text
      2. Value = {Unique ID of desired Person Account record type}
      3. Usage: To store the ID of the Person Account Record Type
  2. First Element – RecordCreate
    1. convertcontact1
    2. Purpose = This element will create the new (non-Person) Account record
    3. Assignments
      1. Create = Account
      2. 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
      3. Assign the ID of new field the AccountID Variable created in Step 1.b
    4. Set this element as starting element.
  3. Second Element – Record Update
    1. convertcontact2
    2. Purpose = This element will update the Contact record to be a child of the new Account.
    3. Filters
      1. Update = Contact
      2. Fields = ID equals ID of sObject Contact variable
    4. Assignments
      1. Update the AccountId field to match the new Account ID stored in the variable (see Step 2.c)
  4. Third Element – RecordUpdate
    1. convertcontact3
    2. Purpose = This element will update the Account to a Person Account by overriding the recordtype ID
    3. Filters
      1. Update = Account
      2. Fields = ID equals AccountID Variable created on Step 1.b
    4. Assignments
      1. Update the RecordTypeID field to the value of the Global Constant created on Step 1.c (image is hardcoded, not preferable)
  5. Connect and Activate
    1. convertcontact4

Step 2 – Create the Process

This Process will trigger to run anytime a Contact is created with Account=NULL.

  1. Process Start
    1. Object = Contact
    2. Start the process = Only when created (this is up to your business preferences)
    3. Allow multiple records in single transaction = False
  2. Action Group
    1. Criteria for executing actions = Filter conditions are met
    2. Filter Condition
      1. Field = [Contact.AccountID]
      2. Operator = Is Null
      3. Value = True
  3. TRUE Immediate Actions
    1. Type = Launch a Flow
    2. Flow = Select Flow created in Step 1
    3. Set Flow Variables
      1. sObject Contact = [Contact]

Finally, Activate and test it out!

convertcontact5

Previous Article
Getting Iframes to Communicate in Salesforce
Getting Iframes to Communicate in Salesforce

By Rohit Sharma Simple as it may seem but to send data from Inline Visualforce page to service console‘s si...

Next Article
Improving Batch Performance With Concurrent Batches In Salesforce
Improving Batch Performance With Concurrent Batches In Salesforce

By Pankaj Mehra We often need to process data in Salesforce using batches — sometimes at the time of migrat...