1

I have created a Journey where the entry event is a Salesforce Data extension and a contact is injected into it when he creates a new record in an object named Application. When it happens, the information regarding the percent completed of the application is saved in the Journey Data Extension and, after a specific date, the system sends an email with this information (using personalization string).

My issue is that I need to map Contact Data and not Journey Data because at the begining, the percent complete is 0%, but when the email is sent the percent complete may be 50% (as an example) and I need this data updated.

How I should change the personalization string in order to map Contact Data instead Journey Data?

  • First of all, welcome to Salesforce StackExchange! If my answer helped, please mark it as accepted, so others can easily identify that this has been resolved. Thanks! – Markus Slabina May 7 at 11:44
7

Option 1: You could retrieve the current value from the synchronized data extensions via AMPscript using the Lookup-function. As a prerequisite you need to have the desired object configured to sync to Marketing Cloud.

Instead of the personalization string you would use a line similar to this:

%%=Lookup('NameOfYourSyncDE','FieldYouLikeToQuery','Id', @VariableContainingTheRecordId)=%%

Option 2: An alternative way is to directly query the record in Sales Cloud using the RetrieveSalesforceObjects-function.

%%[
  VAR @rs, @row, @value
  SET @rs = RetrieveSalesforceObjects('NameOfYourSFDCObject', 'Id,FieldYouLikeToQuery', 'Id', '=', @VariableContainingTheRecordId)
  IF RowCount(@rs) == 1 THEN
    SET @row = Row(@rs, 1)
    SET @value = Field(@row, 'FieldYouLikeToQuery')
  ELSE
    SET @value = 'Fallbackvalue'
  ENDIF
]%%

The above snippet retrieves a value from Sales/Service Cloud and writes it to the variable @value. In order to write it to the email, you need to use the following snippet:

%%=v(@value)=%%

For both options you'd use the Salesforce Record-ID as identifier. Note, that for option 1 there is a delay as synchronization can only appear once every 15 minutes (or even longer intervals, depending on the data source configuration).

Related documentation:

  • thank you! I have chosen option 2 but I'm facing issues with it. I'm sorry but I am not familiar with AMP Script and I should doing something wrong because the The system always returns “Fallbackvalue”. This is how I have completed the code: `%%[VAR @rs, @row, @value SET @rs = RetrieveSalesforceObjects('TargetX_SRMb__Application__c', 'Id,TargetX_App__Percent_Complete__c', 'Id', '=', @Id) IF RowCount(@rs) == 1 THEN SET @row = Row(@rs, 1) SET @value = Field(@row, 'TargetX_App__Percent_Complete__c') ELSE SET @value = 'Fallbackvalue' ENDIF]%%´ Can you help me please?Thanks! – Anna Journeys May 7 at 15:40
  • In order for this to work you need to have the Salesforce-ID of Object "TargetX_App__Percent_Complete__c" in the variable @Id. That variable assignment isn't part of the code you provided so I suppose it isn't present in your code altogether. If this is an attribute and the personalization string %%Id%% would print the Id, you need to add SET @Id = AttributeValue('Id') before the row containing the RetrieveSalesforceObjects-functioncall. Otherwise you need to get that Id from a column in your journey data source. To do that exchange Id in AttributeValue with the column name in your DE. – Markus Slabina May 8 at 7:33
  • 1
    Hi Marcus, I have changed the code adding the SET @Id = AttributeValue ('Id') and now all is working properly. Thank you so much for all your help :) Anna – Anna Journeys May 8 at 12:57
  • You are welcome, glad I could help out ;) – Markus Slabina May 8 at 13:09

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.