Today we are going to create a process that updates the Contact Mailing Address when getting an event registration from Cvent (Event Management Software).
Salesforce Process Automation Tool: Process Builder.
Two things to have in consideration:
1. Street 2 is being captured in a Custom Contact field.
2. Mailing Address (Data Type = address) is a Compound Field.
What is a Compound Field?
Compound fields group together multiple elements of primitive data types, such as numbers or strings, to represent complex data types, such as a location or an address. Compound fields are an abstraction that can simplify application code that handles the values, leading to more concise, understandable code.
Mailing Address is a compound of the following fields: Mailing City, Mailing Country, Mailing Geocode Accuracy, Mailing Latitude, Mailing Longitude, Mailing State/Province, Mailing Street, Mailing Zip/Postal Code.
- Create a Contact Custom Field called “Mailing Street 2”.
- Map Cvent “Street 2” Contact field to Salesforce “Mailing Street 2” Contact field.
- Create a Process in Process Builder.
- Choose Object: Contact
- Specify When to Start the Process: when a record is created or edited
- Define Criteria for this Action Group: Name your Criteria.
- We are going to define two conditions:
a) Is “Mailing Street 2” different than NULL?
b) Does “Mailing Street” contain “”Mailing Street 2”?
- Customize the logic: 1 AND NOT 2. Please note the “NOT 2″. We are going to update “Mailing Street” only if it is not already part of “Mailing Street”. We need to check on this to avoid concatenating “Mailing Street 2” to “Mailing Street” indefinitely when editing the address/record.
- Name your action.
- Record: Contact
- Criteria for Updating Records: No criteria—just update the records!
- Set new field values for the records you update
- Update Mailing Street by using the following formula:
- If you are wondering about this line of code: “SUBSTITUTE($Label.New_Line, “-“,””)&”, please refer to this blog. It explains how to add a line break between “Mailing Street” and “Mailing Street 2”. There’s a known issue with the BR() function, so don’t even try it. It would be a waste of time. I know! It’s a pain.
That’s it! I hope this was helpful to you. Let me know if you have any comments.
If you get ever get this error: “The filter logic references an undefined filter”.
It means that you need to reference to all of your conditions when customizing the logic.
PD: I dedicate this blog post to my 7 year old daughter who is always reminding me and encouraging me to update my blog. ❤️