0

I'm trying to populate the Triggered Send Data Extension with more than just SubscriberKey, EmailAddress, SObject and RecordId.

My AmpScript looks like this:

%%[ 
  /* Retrieves Fields from Salesforce for Triggered Send */ 
 Set @mySObject = SObject
 Set @myRecordId = RecordId 
 Set @Lead = RetrieveSalesforceObjects(SObject,"Salutation, LastName, Academic_Degree__c, Email_SHA512__c","Id", "=", RecordId)
if rowCount(@Lead) > 0 then
  Set @LeadRow = Row(@Lead, 1)
  Set @Salutation = FIELD(@LeadRow, "Salutation")
  Set @LastName = FIELD(@LeadRow, "LastName")
  Set @Academic_Degree__c = FIELD(@LeadRow, "Academic_Degree__c")
  Set @Email_SHA512__c = FIELD(@LeadRow, "Email_SHA512__c")
endif
]%%

My Triggered Send Data Extension has all the fields setup. So I'm trying to populate e.g. the Salutation and LastName field into the triggered send data extension.

Any Idea what I'm missing?

  • I'm guessing your retrieve isn't returning any rows. – Adam Spriggs Jul 11 '18 at 18:40
0

I'd suggest writing out your values so you can validate the lookup:

%%[ 
var @mySObject, @myRecordId, @rowCount, @lead, @LeadRow, @Salutation, @LastName, @Academic_Degree__c, @Email_SHA512__c

Set @mySObject = AttributeValue("SObject")
Set @myRecordId = AttributeValue("RecordId")

Set @Lead = RetrieveSalesforceObjects(SObject,"Salutation, LastName, Academic_Degree__c, Email_SHA512__c","Id", "=", @myRecordId)
set @rowCount = rowCount(@Lead)

if @rowCount > 0 then

  Set @LeadRow = Row(@Lead, 1)
  Set @Salutation = FIELD(@LeadRow, "Salutation")
  Set @LastName = FIELD(@LeadRow, "LastName")
  Set @Academic_Degree__c = FIELD(@LeadRow, "Academic_Degree__c")
  Set @Email_SHA512__c = FIELD(@LeadRow, "Email_SHA512__c")

endif

output(concat("<br>SObject: ", @mySObject))
output(concat("<br>myRecordId: ", @myRecordId))
output(concat("<br>rowCount: ", @rowCount))
output(concat("<br><br>Salutation: ", @Salutation))
output(concat("<br>LastName: ", @LastName))
output(concat("<br>Academic_Degree__c: ", @Academic_Degree__c))
output(concat("<br>Email_SHA512__c: ", @Email_SHA512__c))

]%%

Also, initialize your variables and utilize AttributeValue() to retrieve the values from the send context.

  • Hi Adam, thanks for your comment. The lookup works fine, it is just not writing the output in the DE. Or do you have any idea how to use the dynamic content block with triggered sends? – Tom Raab Jul 17 '18 at 13:21
  • I'd review the data type and precision for each of your SF fields and ensure they match what you've configured in your TSD DE. That could be the issue. – Adam Spriggs Jul 17 '18 at 13:32
  • The fields in TSD DE are setup as text and have enough length I guess. E.g. Salutation with a length of 50. So I would doubt that is the issue – Tom Raab Jul 17 '18 at 13:51

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.