Contacts transition companies all the time and when you find out what do you do in Salesforce? The wrong answer is to just delete them.
Before we get too far into the blog post, if you want to skip all of it and just install the App directly then awesome!
Here’s the Unmanaged package:
Contact – No longer at Company V1.0 – https://login.salesforce.com/packaging/installPackage.apexp?p0=04t1E000000trNv
If you want to learn how to build this yourself, continue on!
There are some ways that would help identify these contacts without deleting them. One of them is to create a checkbox on the contact record that states that the contact is no longer active with that account. You can also place this checkbox just under the contact name so that it would be clear for the end-users. Another idea is to add a Status picklist field that has “Active” and “Inactive” options and that should always default to “Active” unless someone chooses the other choice. You’d use this option if you have more than two options to track. For example, “On Leave” could be something you need to track but most companies aren’t getting that granular with their relationships and therefore a simple checkbox is used in our example.
Either the checkbox field or the picklist field can be the criteria to trigger an automation tool to stop any usual activity that happens with the active contacts. You can also set the automation tool to update the last name of the Contact and add to it “ – No Longer in the Company” text at the end. Moreover, if you usually send emails to the Contacts you can set the automation tool to check the “Email Opt out” field to be sure that the inactive contacts will not receive those emails anymore. The same with any open tasks for the record of that contact, the automation tool can simply end the task. Another method is to add a quick action on the contact object to update the checkbox you created previously.
With any of these ideas , you will be able to report on the Inactive Contacts without the need to delete them. That way you will have clean data and clear history.
Here is how to build Process Builder and Quick Action included in the Package above :
A Process Builder that updates the “Email Opt out” field and the contact’s last name.
- Create a “No Longer at company” Custom field or Picklist depending on your requirements
- Create a new Process Builder with
- Set it to Trigger on the Contact object
- Enter your entry criteria according to your requirements (i.e. No Longer at Company = True)
- Add the first immediate action to update on the Contact object with updating with no entry criteria and updating the Email Opt Out field to True
- Add the second immediate action to update the Contact object with the Last Name field with appended text formula.
” – No Longer at the Company”
- Activate your new Process Builder and move on to adding the quick action.
Quick Action that checks the “No Longer at the Company” field
- Go to Setup > Object Manager > Contact > Buttons, Links, and Actions
- Create a new Action called No Longer At Company to Update a Record as the Action Type.
- Click New under the Predefined Values section and add a formula value of True to the No Longer at Company field.
- Click the Edit Layout button and make sure that the No Longer at Company field is on the layout and any other fields you want to add to this quick action layout.
- Add this Quick Action to relevant page layouts and you’re all set!