Re: New to velocity script - questions

Right_Source_Ma
Level 2

New to velocity script - questions

Two weeks ago, we created an email with a script token for a custom object field containing a unique registration url. Of the 208 emails sent, 12 recipients replied indicating the url didn't work. The team created a my token at the program level (see below) and used the my token in the <a> tag. The field in sfdc is an url field with the 'https://' already appended. Here are my questions (please remember I am new at this):

1. It seems velocity script can become disconnected from the custom object, could this be the case here and only for a select number of persons?

2. Is there a better way to handle urls in velocity scripts? From the reading I have done, it seems reconstructing the urls may be a good way to go? Please keep in mind in the current set-up all I have in the full url being pushed from sfdc

3. Velocity scripts don't work in the sampling feature, correct?

Script token details: ${CRLC_Application__cList.get(0).RSVP_Link__c}

Token name: my.CRL-RSVP-Link

{my.CRL-RSVP-Link} was hyperlinked

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: New to velocity script - questions

1. No, this is not at all expected.

2. You should output the entire <a> tag from Velocity, including the closing </a>, not only the href.

3. Correct, don't use samples. Use Preview-by-List or a real email.

Since you haven't given an example of working and non-working URLs and their corresponding Custom Object data, I can't give more specific help.

P.S. You're currently referencing the first record in the list of objects (index 0) every time. Are you sure that's what you want?

Right_Source_Ma
Level 2

Re: New to velocity script - questions

Sanford Whiteman wrote:

P.S. You're currently referencing the first record in the list of objects (index 0) every time. Are you sure that's what you want?

I'm not certain. Still learning this. When we used this the first go round, it worked except for a handful of people.

SanfordWhiteman
Level 10 - Community Moderator

Re: New to velocity script - questions

I'm not certain. Still learning this. When we used this the first go round, it worked except for a handful of people.

Well, as you add Custom Object records over time, the same code is not going to have the same meaning.

What are the characteristics of the CO record that you're trying to target on the lead?  If there's a chance that the lead may have more than one record added (and old ones not deleted) then surely "use the first one all the time" is not the business requirement!

Mark_Price
Level 7

Re: New to velocity script - questions

You mentioned the url contained 'https://'.   I would strip that and insert the URL like so and see what happens:

<a href="https://${url}">Register Here</a>

Maybe check email link performance report and see if there are any links that are: 'malformed link' or your variable.