SOLVED

Re: URL Not Resolving in Email Script Token

Go to solution
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: URL Not Resolving in Email Script Token


@adanand wrote:

Hi @SanfordWhiteman @Darshil_Shah1 ,

Hope you are doing well. Wanted to check with you in case you can please share any insight on the below :-

Background: Continuing from this post above, could you please advise if the way one can pull Custom Object fields (of hyperlink link and hyperlink text) into a Velocity Script token to make one script token pulled into an email. This is possible with Custom Object fields. 

eg using the two hyperlink link and hyperlink text Custom Object fields to work together to form a hyperlink in an email by placing the script token {{my.CTA-URL}} in the email.

cta_url:

 

{{my.CTA-URL}}

<a href="https://${List.get(0).cta_url}&utm_source=marketo">${vMC_cList.get(0).op_tip1_cta_text}</a>##
cta_text

{{my.CTA-TEXT}}

{{my.CTA-TEXT}}

My question is : I wanted to ask if the above use case is also possible using a text token or a rich text token, in the absence of Custom Object fields to pull into the a href above? Or can I use an ad hoc custom object field in the email program to make the hyperlink for the email, which token gets loaded through API?

Thanks


Hi @adanand - yes, I'm well! Thank you for asking! Hope you're well too!

 

I'm a bit unclear about your exact ask, so I'm gonna answer based on my understanding of your question and try to cover all the possible scenarios I can think of:

 

First, you can't reference the text my token in the velocity, but, you can pass through a value to multiple email scripts using a macro. https://velocity.apache.org/engine/1.7/user-guide.html#velocimacros.

 

This is likely overkill for what you are trying to do as you can simply define the URL value in your primary script token, but it might be worth it if you had many email script tokens that were dependent on that URL token or don't want people to open up your email script token with the logic just to update the URL.

 

Also, secondly, if your URL value is in the custom object, then you'd have to reference it using the email script token only, can't use the simple text/rich text tokens. Also, fields on objects other than the CO maintain a 1-1 relationship with the person, or in the case of a custom token, the token value is managed at the program level, unlike the custom object, you can't associate multiple values for the same attribute with the same person record (1-n relationship). There's a way to store data in a structured format (e.g., JSON) in the custom fields, but again you'd need velocity to parse it!

 

I hope this answers your question, if not, or if you have any further questions, please feel free to let us know and we'd be happy to help!