Hi @Darshil_Shah1 , @SanfordWhiteman ,
I much appreciate your response and guidance and have gotten the link to work and track.
To get the links to work:
VELOCITY TOKEN :
I input this in the velocity token code below and checked the variables op_tip1_cta_url and op_tip1_cta_text on the right side where all VMC custom object fields are listed inside the velocity token.
<a href="https://${vMC_cList.get(0).op_tip1_cta_url}&utm_source=marketo&utm_medium=email&utm_campaign=mid_6118&utm_content=na&utm_term=advanced_email">${vMC_cList.get(0).op_tip1_cta_text}</a>##
REFERERRED the above velocity token in the email as : {{my.VMC-OP-TIP1-CTA-URL}}
However, I am concerned about not having done the sort - as you said, without sorting, there's a fair possibility that you might reference the wrong data in your email. sorting is done via the velocity's sort tool for use in the script. By default the COs are stored in the descending order of their created order. If a person has multiple custom object records associated with them, out of all those, which of the record would you like to be considered for populating the correct URL? ---> are you please able to share what am I to implement this sort - is it done inside another additional new velocity token?
Are you able to advise on how to implement sorting, in the above case where links are working and tracking for one test record
Many thanks,
Aditi
That’s why I keep asking Which item in the list is the one you want to output?
This is a business question. We can’t tell you that you want output the most recently updated one... or the first created one... or the earliest created one that also has a field set to a specific value.
Your answer to this question determines how to execute the sort.
Hi
I have a follow on question on velocity link token please
In a velocity script token, I am using the following velocity link token code and in the email body just has the reference to this below link token as text {{my.link}} in the email body. The link as used like this is clicking and tracking both :-
<a href="https://${vMC_cList.get(0).op_tip2_cta_url}&utm_source=marketo&utm_medium=email&utm_campaign=m&utm_content=na&utm_term=advanced_email">${vMC_cList.get(0).op_tip2_cta_text}</a>
Now, I have a use case where sometimes the Custom Object data may not have a link cta text and cta url. In that case, when the Custom Object data for cta text and cta url shows as then the email body shows a hyperlinked '-' broken link with params as above.
I want to be able to create a rule in the velocity script link token such that when the Custom Object field for cta url and cta text shows ( as signifying a blank value in the Custom Object cta text and cta url fields) then show nothing in the email body (so I can avoid the broken hyperlink '-' in the email body)
Please advise
Thanks
Well, what are the data in the URL and CTA text CO object fields in the CO record when they're blank? Is it "-" or null? Based on that we can define the if condition. You can print the VMC CO List ${vMC_cList} where you've blank values and check if you aren't sure.
For allowing only standard non-null and non-empty values, you could use the following condition:
#if(!$vMC_cList.get(0).op_tip2_cta_url.isEmpty() && $vMC_cList.get(0).op_tip2_cta_url && !$vMC_cList.get(0).op_tip2_cta_text.isEmpty() && $vMC_cList.get(0).op_tip2_cta_text)
<a href="https://${vMC_cList.get(0).op_tip2_cta_url}&utm_source=marketo&utm_medium=email&utm_campaign=m&utm_content=na&utm_term=advanced_email">${vMC_cList.get(0).op_tip2_cta_text}</a>
#end
The script would only print the link if both $vMC_cList.get(0).op_tip2_cta_url and $vMC_cList.get(0).op_tip2_cta_text are non-empty and non-null.
Please show the output (not expurgated or altered) of ${vMC_cList} in which one item has the literal string nbsp; in the relevant fields.
Hi,
Continuing from this post above, could you please advise if that 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}} |
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?
Thanks
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
Why are you seeking the first item (.get(0)
) in the list? What’s special about that item?
In general, you should not be accessing the first item unless you have first sorted the list in a deliberate way — yes, even if you believe there will only be one item in the list, you should still sort it because Marketo itself cannot guarantee there’s only one.
Thanks so much for replying @SanfordWhiteman . I'll check and get back
Thanks!