Focusing here on the Contact object, below is an example how Address 1 and Address 2 could be used in combination with the MailingStreet field.
As there is likely syncing from and to Engaging Networks; two separate processes are required :
- The first is to combine Address 1 and 2 into one field on the Engaging Networks Import Record, in order to populate MailingStreet on processing.
- The second is to separate MailingStreet, into two fields on the Contact object, in order for this data to be pushed correctly to Engaging Networks.
Before creating the following formula and workflows, a Custom Label needs to be created. This will provide a workaround to insert and then find/replace new line characters for the addresses. It is based off an idea expressed on this blog.
Create a custom label
Head to Setup and create a new 'Custom Label' named 'NewLine'.
as the default text.
Formula to Combine Address 1 and 2
Head to the field settings of the Engaging Networks Import Record.
Create a new formula input field and it Mailing Street Combined.
Set the formula to be
CASE(Len(Trim(EN_Connector__address_2__c)), 0, EN_Connector__address_1__c, EN_Connector__address_1__c & SUBSTITUTE($Label.NewLine, "-", "") & EN_Connector__address_2__c)
The next step is to expose this new field to the Engaging Networks Mapping dropdown selections. To do this, on the Engaging Networks Import Record, find the field set called Record Query Filter and drag Mailing Street Combined to be part of the field set.
Create a Workflow to separate MailingStreet into Address 1 and Address 2
In order for MailingStreet value to be separated into two inputs. We will leverage one field that is already installed to the Contact and create a new field called 'EN Address 1'.
Start by heading to the Contact object's settings. You will see a field already created named EN_Connector__Address_2__c. If MailingStreet has more than one line present, this field will hold the text after line 1.
Next, create a new field on the Contact object and name it EN Address 1. This field will hold the first line of the MailingStreet text.
Following this, create a new Workflow Rule on the Contact object and name it Separate MailingStreet. Enter the settings as below.
Inside the workflow, two Workflow Actions must be set to fire off. These two will take line one and populate to EN Address 1 and if there is a new line character present, grab the remaining lines and populate them to EN Address 2.
Below are the formulas you can use for each Workflow action. Please test that these work appropriately for your account. In the context of 'Pushing Contacts to Engaging Networks', you can then use these fields instead of MailingStreet.
Address 1 Workflow Formula
IF( ISBLANK(MailingStreet), "", IF( CONTAINS(MailingStreet, MID($Label.NewLine,3,1)), LEFT( MailingStreet, FIND(MID($Label.NewLine,3,1), MailingStreet) ), MailingStreet ) )
Address 2 Workflow Formula
IF( CONTAINS(MailingStreet, MID($Label.NewLine,3,1)), RIGHT(MailingStreet,(LEN(MailingStreet)-FIND(MID($Label.NewLine,3,1), MailingStreet )) ), "" )