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

A person record can have multiple custom object records associated with it, of all of those which CO record would you like to be  considered for populating the URL? I suppose you won’t output links present in all the custom object records in vMC_cList, right? Also removing the index argument from the get function isn’t enough. You’ll run into an error. Ideally, we should first sort the list of CO records in the required order and then grab the correct CO record for populating the data based on it in the email. If you’re still unclear, do you want to hop on a call to discuss this? I think that would be better and faster instead of exchanging comments here?

adanand
Level 2

Re: URL Not Resolving in Email Script Token

Thanks very much @Darshil_Shah1 yes, this will indeed be more clear then

SanfordWhiteman
Level 10 - Community Moderator

Re: URL Not Resolving in Email Script Token


your question 1 :

Show the output of the line:
${vMC_cList}

Answer 1 :

I got a long list of fields and their values from the Custom Object fields, some items are below :

help_url=url,

ImgURL=image link,

vis_metric1_img_url=image link,

op_body_text=text,

op_tip1_body_text=text

contact_url=url,

vis_metric2_text=12,


Nothing is gained by obfuscating your data to this degree. We want to see the type of value stored in your fields, since those fields may be used to filter the list.

 

Answer 2 :

The intent is not to output 0th-th item from a list at all. The intent is just to populate the link called through the velocity token in the email for all records that qualify for the email

 

To answer 2: should I only be using ${vMC_cList.get().op_tip1_cta_url} instead of ${vMC_cList.get(0).op_tip1_cta_url} -


List.get() has no meaning. It’s a fatal error. List.get(n) gets the n-th item in a list. You must choose an item. Again, we assume you do not want a random item.

 

Think about this real world example:

 

You have a closet full of an unknown number of shirts. You want to pick out a shirt to wear to a specific event. You know how to pick one shirt at random from your closet. Are you ready to go to that event? Does it not matter which shirt you choose?

adanand
Level 2

Re: URL Not Resolving in Email Script Token

Thanks very much @SanfordWhiteman , 

I much appreciate your response and guidance

 

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: URL Not Resolving in Email Script Token

Hello @adanand, custom objects are stored in descending order of their created date. So the first custom object in the CO list would be the one that was added last, usually in almost all of the cases this does not get us anywhere, and hence we first sort the custom object list per our requirement (e.g., sort by updated date, a field, etc.) and then start working with the records in it (as once sorted we'd know the order of records in it). Additionally, are you assuming that a custom object can only contain 1 record? If so that's not true, a CO can contain n number of records, all of which together make a custom object list. Also, after sorting we aren't gonna grab the entire list, just the relevant field from a particular CO record.

 

Furthermore, what we mean by outputting the complete <a> through </a> is that you need to have something like the below in your velocity script (of course after doing the necessary sorting first):

 

<a href="https://${vMC_cList.get(0).performance_cta_url}?utm_medium=paid-social&utm_source=linkedin&utm_campaign=ABC_Test">Click here</a>

 

You can't just output just the URL from the CO field from a velocity token, then reference it in the email's link editor. You have to output the fully formed <a> tag from the velocity script itself.

 

I hope this is useful. Pls let us know if you have questions.

 

adanand
Level 2

Re: URL Not Resolving in Email Script Token

Hi @Darshil_Shah1 ,

 

Many thanks for your response

 

Assuming I use this code in the velocity token :

<a href="https://${vMC_cList.get(0).performance_cta_url}?utm_medium=paid-social&utm_source=linkedin&utm_campaign=ABC_Test">Click here</a>

 

How do I reference this code in the HTML editor? : ??

 

Currently I have this in the HTML editor : have the protocol in the email body: The link we are sending to the Custom Object does not have https:// to enable tracking :

href="https://{{my.VMC-PERFORMANCE-CTA-URL}}{{my.cta1-URLparams}}"

 

Thanks,

 

Aditi

 

 

Tags (1)
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: URL Not Resolving in Email Script Token

Please reference the velocity token in the email editor. So, if your velocity token is {{my.link}}, just add it wherever you wish to output the link in the email. You don't need to insert it via the "Insert/Edit Link" option in the Rich text, just insert the velocity token at the apt. space, and you should be golden. Also, please copy the UTM parameters from your existing {{my.cta1-URLparams}} token and add them to the URL in your velocity token. Also, I hope you got an idea about the importance of sorting, right? As w/o it, there's a fair possibility that you might reference the wrong data in your email.

 

adanand
Level 2

Re: URL Not Resolving in Email Script Token

Hi @Darshil_Shah1 

 

Many thanks for this 

 

There are 70 fields in this Custom Object - with 10 links - are you please able to elaborate on the sorting aspect? 

Where do I sort these 70 fields on the Custom Object - is this also done via the velocity script?

 

Thanks,

 

Aditi

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: URL Not Resolving in Email Script Token

Yes, sorting is done via the velocity's sort tool for use in the script. As I said earlier, 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? Would it be the most recently updated custom object record or something else?

 

adanand
Level 2

Re: URL Not Resolving in Email Script Token

Hi @Darshil_Shah1 

 

Many thanks for this

 

Your note helped resolve the issue - now not only are the links working, they are tracking as well.

 

Thanks,

 

Aditi

Tags (1)