Custom token from a custom Object field | Community
Skip to main content
June 22, 2016
Question

Custom token from a custom Object field

  • June 22, 2016
  • 3 replies
  • 2316 views

Hey Marketo Community,

I'm trying to define a custom token with the following email script:

#set($my.ProjectOwnerName = "${Milestone1_Project__cList.get(0).OwnerId}") 

#end

${my.ProjectOwnerName}

We have custom Object in SFDC called "Project" and I'm trying to define this new token by the value in the Project field name "Owner ID".

When I reference this token in an email in the subject line and email copy, I get the following error message. Any ideas how to troubleshoot? Anyone have a good set of error code definitions to reference? Thanks in advance for your help.

An error occurred when procesing the email Headers!

Encountered "#end\n" near

Subject: #set($my.ProjectOwnerName = "${Milestone1_Project__cList.get(0).OwnerId}")  
#end
${my.ProjectOwnerName} owns this project

Daniel

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Level 2
June 22, 2016

I don't think email scripting tokens work in subject lines.

Try placing that in the body of your email and see if you still get an error. If not, you will know it's the location that's the issue.

July 24, 2016

Hey Maria,

Thanks for your reply. Email scripting has worked for us in the subject lines and it turns out the solution was just the following:

${Milestone1_Project__cList.get(0).OwnerId}

July 26, 2016

Hi Daniel,

Tokens will work in subject lines.  you don't need to add #end when you set a variable.

#set($ProjectOwnerName = ${Milestone1_Project__cList.get(0).OwnerId})

${ProjectOwnerName}

That being said, I see another problem here. Your subject will always grab the first data value OwnerId for all emails. Depending on the campaign if Triggered then change it to   #set($ProjectOwnerName = $!{TriggerObject.OwnerId}). This will get the ID which triggered this campaigh.

Batch campaign will be different though.

HTH

Mahesh