I am trying to extract data from synchronized data extension "Case_Salesforce" to show on an email. Is it possible to do this? I am using lookup function to achieve. I can get synchronized data extension "Contact_Salesforce" ,but cannot get data out of "Case_Salesforce". Does Anyone know what the differnce is between them?

var @lookupvalue,@CaseId,@Subject,@ContactEmail,@Status<br>
set @lookupvalue = AttributeValue("_subscriberkey")<br>
set @CaseId = Lookup("Case_Salesforce","Id","Id",@lookupvalue)<br>
set @Subject = Lookup("Case_Salesforce","Subject","Id",@lookupvalue)<br>
set @ContactEmail = Lookup("Case_Salesforce","ContactEmail","Id",@lookupvalue)<br>
set @Status = Lookup("Case_Salesforce","Status","Id",@lookupvalue)<br>
Case Detail<br>
  • AttributeValue("_subscriberkey") delete the " that it becomes AttributeValue(_subscriberkey) – Johannes Schapdick Jan 10 at 8:15
  • I revised this script as you commented but didn't work. – Masashi Jan 10 at 8:19
  • Is the column where your subscriberkey is located really named "id" in all dataextensions? Is it really subscriberkey or is it subscriberid? Furthermore this makes no sense set @CaseId = Lookup("Case_Salesforce","Id","Id",@lookupvalue) you lookup the "ID" value and search with ID you insert there. That makes no sense – Johannes Schapdick Jan 10 at 8:21
  • One sidenote: It makes no sense to do 4 Lookups against the same dataextension when you could use LookUpRows oder LookUpOrderedRows functions. – Johannes Schapdick Jan 10 at 8:35
  • Thank you for your advice. Though I wondered that the error is difference between "Contact_Salesforce" and “Case_Salesforce”,can ampscript I modify well extract data from synchronized data extension “Case_Salesforce” ? – Masashi Jan 10 at 8:50
  • Please make sure you have these additional fields added to your SYNCED object. enter image description here
    • Then make sure you are searching based on "ContactID" and NOT "Id"
var @lookupvalue,@CaseId,@Subject,@ContactEmail,@Status
set @lookupvalue = "0030o00002dgaRDAAY"
set @CaseId = Lookup("Case_Salesforce","Id","ContactId",@lookupvalue)
set @Subject = Lookup("Case_Salesforce","Subject","ContactId",@lookupvalue)
set @ContactEmail = Lookup("Case_Salesforce","ContactEmail","ContactId",@lookupvalue)
set @Status = Lookup("Case_Salesforce","Status","ContactId",@lookupvalue)

Case Detail
CaseID:%%=v(@CaseId)=%% <br/>
Subject:%%=v(@Subject)=%% <br/>
Status:%%=v(@Status)=%% <br/>
  • I have hardcoded the subkey for testing. And it worked for me! enter image description here
| improve this answer | |
  • Thank you for your advice. I confirmed that your script works in my instance as expected. Would you tell me what I should use to instead of hard-code? "subkey"? or "subid"? – Masashi Jan 10 at 9:28
  • @Masashi - subid is an internal ID of SFMC. The Contact ID from SC is to be referenced as subkey – Lukas Lunow Jan 10 at 9:54
  • @Kumar Can't any fields except Contact ID from SF referenced as subkey? – Masashi Jan 10 at 10:08
  • As per my knowledge it's always better only to use either ContactId or. LeadId as SubKey.... Preferably 18digitId if u have.. else u can go with regular 15 digit IDs – Vishal Kumar C V Jan 10 at 19: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.