Custom token from a custom Object field

Anonymous
Not applicable

Custom token from a custom Object field

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

pastedImage_1.png

Daniel

3 REPLIES 3
autodeskglobal_
Level 1

Re: Custom token from a custom Object field

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.

Anonymous
Not applicable

Re: Custom token from a custom Object field

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}

Anonymous
Not applicable

Re: Custom token from a custom Object field

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