22.6.1. Storing Message Contents in Salesforce

Prev Next

This guide will walk you through the steps of creating a Data Analytics routing policy to store the contents of all your digital messages in Salesforce as an Activity.

Step 1: Creating a Data Analytics Routing Policy

Start by navigating to the Routing Policies tab and pressing the New button.

Select the policy type as “Data Analytics”, you may name the policy however you like.

Step 2: Creating and Configuring the Event

Now that you have your Data Analytics routing policy we can begin to build out the routing logic, the first part of this is creating the Event container and configuring the Message created event.

To do this hover over the “Click here to Start” space and select “Add Event”. This will then create an empty Event Container within your Policy.

Select the Event container which will open the sidebar to allow you to configure it. Press the “Select Event” button which will open the event selection screen.

Select the checkbox next to the event labelled “Digital Message Created” and then press the Save button in the bottom right corner.

Your event has now been created.

Step 3: Querying the Contact to relate this to

Now that we have our event we can begin to create the rest of the policy that includes querying the appropriate Contact record and then creating an Activity related to this Contact.

The first part is to create a Query Object app, you can do this by selecting the Event container and then pressing Link and selecting Action. You have now created a new empty Action container which we can then add a Query Object App to this.

On the Query Object app we want to configure the following:

  • Set the Result Set to “Contact”

  • Change the Record Type to “Contact” so we are querying the Contact object

  • Click Add fields and set the field to “Mobile Phone” (You can use another phone field if that is what you are using for Contact records)

  • Under the newly created query parameter created above set the value to $(Payload_Event.event.messageInfo.identityAddress) - this will be the phone number of the customer that the message is sent to or received from

  • In the Available fields section we want to return the Contact Id

Now that we have configured our Contact query we can create a connecting Action container if a result is returned for the contact query. To do this you need to click on the red plus next to the app (it will be the red plus closest to the top right corner of the container) and then press “Action” in the sidebar to create a new action container.

Finally for the contact query we want to add a retry app should the query fail for whatever reason, select the Red plus at the bottom right corner of the app and then press Finish - you will then need to select the retry app to add the retry app to the finish container.

Step 4: Creating the Activity

Select the empty action container that was created at the end of the previous step and select the “Create a Record” app from the sidebar.

On the Create a Record app we want to configure the following:

  • Set the result set to “Activity”

  • Change the Record type to “Task”

  • Set the first field to be “Name ID”

  • Set the value for the first field as $(SForce_Contact.Id) - this uses the Contact query we did in the previous step

  • Click Add Row to add another field and select “Description”

  • Set the value for the second field as $(Payload_Event.event.messagePayLoad.textMessage.text)

Finally we need to set up the retry if the creation should fail for any reason. Simply select the red plus in the bottom right corner of the app and select the Finish container from the sidebar, then select the “Retry” app.