0

I need help with a journey which I have created. I have created a journey to send email on the basis of opportunity stage on an email field which exist in Salesforce opportunity.

I have used the following AMPscript code in HTML email template, but when final mail is coming up Opporunity name field which I have put in template stays empty.

My code:

%%[ var @rs

Set @rs= RetrieveSalesforceObjects('Opportunity', 'Id, Name,StageName', 'Name', '!=', 'abc')

]%%

%%=v(@Name)=%% //to print opportunity name

Thanks,

Praneet

2

In your code, you had just retrieved the salesforce object values and saved it in a list. You cannot directly display the values in the list. You would need to update your query as below

%%[ var @rs, @Oppname, @Opprow

Set @rs= RetrieveSalesforceObjects('Opportunity', 'Id, Name,StageName', 'Name', '!=', 'abc')

Set @Opprow = ROW(@rs,1)

Set @Oppname = FIELD(@Opprow ,"Name") 

]%%

%%=v(@Oppname)=%% //to print opportunity name

Refer to the link for reference.

|improve this answer|||||
0

Thanks for your reply! I used the above and modify to pull the Opportunity which is entering the journey but doing so I am getting Random Opportunity name in the template.

Here is the code look like

 >%%[ var @rs, @Oppname, @Opprow
 Set @rs= RetrieveSalesforceObjects('Opportunity', 'Id, Name,StageName,CaseSafeID__c', 'CaseSafeID__c', '=', '_subscriberkey')
 Set @Opprow = ROW(@rs,1)
 Set @Oppname = FIELD(@Opprow ,"Name") 
 ]%%

 %%=v(@Oppname)=%% //to print opportunity name
|improve this answer|||||
  • Did you check the query in Salesforce. Your query should have returned more than one record and the first record name is displayed in the template. – Ganesh Kumar Jan 8 '17 at 18:31

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.