0

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?

%%[<br>
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>
]%%<p>
Case Detail<br>
CaseID:%%=v(@CaseId)=%%<br>
Subject:%%=v(@Subject)=%%<br>
Status:%%=v(@Status)=%%<br>
</p>
6
  • AttributeValue("_subscriberkey") delete the " that it becomes AttributeValue(_subscriberkey) Commented Jan 10, 2020 at 8:15
  • I revised this script as you commented but didn't work.
    – Masashi
    Commented Jan 10, 2020 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 Commented Jan 10, 2020 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. Commented Jan 10, 2020 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
    Commented Jan 10, 2020 at 8:50

1 Answer 1

1
  • 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
4
  • 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
    Commented Jan 10, 2020 at 9:28
  • @Masashi - subid is an internal ID of SFMC. The Contact ID from SC is to be referenced as subkey Commented Jan 10, 2020 at 9:54
  • @Kumar Can't any fields except Contact ID from SF referenced as subkey?
    – Masashi
    Commented Jan 10, 2020 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 Commented Jan 10, 2020 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .