2

I'm trying to reference SalesCloud event data inside an SMS interaction in journey builder:

%%[set @fname = AttributeValue('Contact:FirstName')]%%
Hello %%=v(@fname)=%%!

This doesn't return any value for Contact First Name. I found a workaround where I use LookupOrderedRows and use Mobile Number to search entry event DE to retrieve FirstName.

%%[
set @number = MOBILE_NUMBER
set @orderedRows = LookupOrderedRows('DE', 1, 'Contact:CreatedDate DESC', 'Contact:MobilePhone', Concat('+', @number))
if RowCount(@orderedRows) > 0 then
    set @fname = Field(Row(@orderedRows, 1), 'Contact:FirstName')
endif
]%%
Hello %%=v(@fname)=%%!

This works fine for short journeys or no re-entry type ones, but for long one that allows to re-enter anytime I don't have 100% certainty of getting correct entry data. Wanted to ask, if I'm maybe using AttribueValue incorrectly or is there a better way to get the information I want?

  • Have the same problem, would love to hear if you find a solution. I've been working with Salesforce Support about this and if they get back to me with something will post it up. – Steve Dec 7 '17 at 5:23
  • Other than MOBILE_NUMBER what other attributes are available by default? I need Contact Key/Subscriber Key. @Steve – sfdcFanBoy Apr 5 '18 at 10:30
0

It is a limitation of MobileConnect. Have the same issue with a similar scenario, having one MobileConnect contact and multiple records entering the journey to then send SMS from MobileConnect for each individual record.

The script you are using is all you can do with MobileConnect, unless an update comes from Salesforce to link the MobileConnect Contact with journey data so you can select the individual record to use for the SMS.

  • I figured how to achieve it, posted answer below. – Mateusz Bartkowiak May 11 '18 at 14:24
0

I figured it out. I added 3 more fields to my Entry Event data extension, these are - Boolean, Nullable and are by default set to False. I called them SMS1Sent, SMS2Sent, SMS3Sent. I update them when I send the sms and then use them to get correct message data to send at a given time. For SMS 1 I used:

%%[set @number = MOBILE_NUMBER
set @orderedRows = LookupOrderedRows('DE', 1, 'Reservation__c:CreatedDate ASC', 'Reservation__c:Contact__r:Phone', Concat('+', @number), 'SMS1Sent', 0)
if RowCount(@orderedRows) > 0 then
    /*Do something here*/
    set @reservationID = Field(Row(@orderedRows, 1), 'Reservation__c:Id')
    set @updateStatus = UpdateData('DE', 1, 'Reservation__c:Id', @reservationID, 'SMS1Sent', 1)
endif]%%

Then for next SMS I look for a record using Mobile Number and SMS1Sent = true and SMS2Sent = false

%%[set @number = MOBILE_NUMBER
set @orderedRows = LookupOrderedRows('DE', 1, 'Reservation__c:CreatedDate ASC', 'Reservation__c:Contact__r:Phone', Concat('+', @number), 'SMS1Sent', 1, 'SMS2Sent', 0)
if RowCount(@orderedRows) > 0 then
    /*Do something here*/
    set @reservationID = Field(Row(@orderedRows, 1), 'Reservation__c:Id')
    set @updateStatus = UpdateData('DE', 1, 'Reservation__c:Id', @reservationID, 'SMS2Sent', 1)
endif]%%

Third would be SMS2Sent = true and SMS3Sent = false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.