Hi all,
I open this thread to report a malfunction (or so it seems), of a velocity token.
Before I explain the malfunction though, it is necessary to put the problem in context.
Due to the integration with CRM (D365), I have a token that is written via API.
Within this token are multiple links.
All the links have this composition: (https://www.[...]_Registration.html).
I would like to parameterize these links with the GUID of each user's Company.
However, obviously, it is not possible to have "nested tokens," so to act on a link that comes from CRM and is already contained in tokens, another way is needed.
So we thought of writing a VLC Token that, thanks to the "Program Member Data," does a replace of all the final parts of the links, like this:
## GET EVENT DATA FROM MEMBER FIELD
#set($event_invitation_token = "" )
#if($member.eventInvitationToken && !$member.eventInvitationToken.isEmpty())
#set( $event_invitation_token = ${member.eventInvitationToken})
#end
#set($event_invitation_token_edited = $event_invitation_token.replace("Registration.html","Registration.html?aid=${lead.accountid_account}"))
$event_invitation_token_edited
This is the VLC token in its entirety.
The action involved is given by "replace."
So. what happens?
Hapens that the operation of the token is random, and different for each user.
In fact, it seems that the vlc token cannot act on the entire contents of the original token, but processes about half of it--a little more, a little less.
What do you think could be the causes?
Base Token (see the 4 block with button)
VLC Token for user A (just 2 block "processed" by the token):
VLC Token for user B:
As you can see, 2 blocks processed, started to process the 3rd one, than stopped.
Really curious to read something!
Thank you to anyone who wants to take a few minutes to try to understand the problem!
Solved! Go to Solution.
@jolivieri -
This field "Event Invitation Field" must be of string type and I am sure any field of string type will not be able to store this much of characters as your code have.
I tried to do the same thing in my demo account and code got truncated. This is why you are not able to see all 4 block in the rendering.
I would like to suggest a possible solution. Could we consider adding the following section to the source code(wherever required) in the CRM: "?aid=${lead.accountid_account}". This should ensure that when the token is passed to Marketo, it will function correctly.
Thanks!
First, a little housekeeping:
Next, let’s make sure we’re using the right terms. When you say:
Due to the integration with CRM (D365), I have a token that is written via API.Within this token are multiple links.
(1) Do you actually mean you have a Program Member Custom Field? That’s not the same as a token. A token ({{lead.token}}, {{company.token}}, {{member.token}}) can be used to output a field. But the field is not a token. The only tokens that can be written directly via API are {{my.tokens}}.
(2) What do you mean by “within this [field or token] are multiple links”? What are the multiple links? Please give complete examples.
Finally, how are you deploying the Velocity {{my.token}} within the email HTML? Again with a complete example.
It’s very, very unlikely that your VTL is randomly truncating anything. But there’s not enough information yet to give a recommendation.
Hi Sandford, thanks for the suggestions. I will keep them in mind from now on for future tickets and personal knowledge. Didn't know about the code, so Thank you!
(1) I have a Program Member Custom Field.
The process is: CRM fill the token {{my.email_not_ot}}
The Token {{my.email_not_ot}} is inserted inside the Program Member Custom Field "Event Invitation Field"
The VTL Run on the "Event Invitation Field" content.
(2) This is the content which is coming from the CRM via API
<p><br></p><table cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td style='font-family:Arial,sans-serif;text-align:left;width:70%'><h2 style='color:#000'>LUCCA dal 11 Marzo 2024 al 12 Marzo 2024<br></h2><p><strong>DATA INIZIO: 11 Marzo – ore 09:15 – 10:30</strong></p><p><strong>DATA FINE: 12 Marzo – ore : – :</strong></p><p><strong>Costo: 23€</strong></p><p><strong></strong><br></p></td><td style='text-align:left;vertical-align:top;width:30%'><a href=' https://stage-events.ariston-oneteam.com/7930926b-23d6-ee11-904d-000d3ab78251_Registration.html' style='background-color:red;color:#fff;padding:10px 20px;text-decoration:none;border-radius:20px;font-family:Arial,sans-serif;font-size:14px;font-weight:700;display:inline-block'>Registrati</a></td></tr></tbody></table><table cellpadding='0' cellspacing='0' width='100%'><tbody></tbody></table><p><br></p><table cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td style='font-family:Arial,sans-serif;text-align:left;width:70%'><h2 style='color:#000'>LUCCA dal 11 Marzo 2024 al 12 Marzo 2024<br></h2><p><strong>DATA INIZIO: 11 Marzo – ore 09:15 – 10:30</strong></p><p><strong>DATA FINE: 12 Marzo – ore : – :</strong></p><p><strong>Costo: 23€</strong></p><p><strong></strong><br></p></td><td style='text-align:left;vertical-align:top;width:30%'><a href=' https://stage-events.ariston-oneteam.com/7930926b-23d6-ee11-904d-000d3ab78251_Registration.html' style='background-color:red;color:#fff;padding:10px 20px;text-decoration:none;border-radius:20px;font-family:Arial,sans-serif;font-size:14px;font-weight:700;display:inline-block'>Registrati</a></td></tr></tbody></table><table cellpadding='0' cellspacing='0' width='100%'><tbody></tbody></table><p><br></p><table cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td style='font-family:Arial,sans-serif;text-align:left;width:70%'><h2 style='color:#000'>LUCCA dal 11 Marzo 2024 al 12 Marzo 2024<br></h2><p><strong>DATA INIZIO: 11 Marzo – ore 09:15 – 10:30</strong></p><p><strong>DATA FINE: 12 Marzo – ore : – :</strong></p><p><strong>Costo: 23€</strong></p><p><strong></strong><br></p></td><td style='text-align:left;vertical-align:top;width:30%'><a href=' https://stage-events.ariston-oneteam.com/7930926b-23d6-ee11-904d-000d3ab78251_Registration.html' style='background-color:red;color:#fff;padding:10px 20px;text-decoration:none;border-radius:20px;font-family:Arial,sans-serif;font-size:14px;font-weight:700;display:inline-block'>Registrati</a></td></tr></tbody></table><table cellpadding='0' cellspacing='0' width='100%'><tbody></tbody></table><p><br></p><table cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td style='font-family:Arial,sans-serif;text-align:left;width:70%'><h2 style='color:#000'>LUCCA dal 11 Marzo 2024 al 12 Marzo 2024<br></h2><p><strong>DATA INIZIO: 11 Marzo – ore 09:15 – 10:30</strong></p><p><strong>DATA FINE: 12 Marzo – ore : – :</strong></p><p><strong>Costo: 23€</strong></p><p><strong></strong><br></p></td><td style='text-align:left;vertical-align:top;width:30%'><a href=' https://stage-events.ariston-oneteam.com/7930926b-23d6-ee11-904d-000d3ab78251_Registration.html' style='background-color:red;color:#fff;padding:10px 20px;text-decoration:none;border-radius:20px;font-family:Arial,sans-serif;font-size:14px;font-weight:700;display:inline-block'>Registrati</a></td></tr></tbody></table><table cellpadding='0' cellspacing='0' width='100%'><tbody></tbody></table>
This is how the code looks:
Inside every button there is one specific link (every link has the same format: https://website.(eventID)_Registration.html
The VTL Token should replace Registration.html with Registration.html?aid={{lead.account}
And, the VTL Token is in the email, like this:
Hope to Answered to all your questions / points.
Thanks for your time!
@jolivieri -
This field "Event Invitation Field" must be of string type and I am sure any field of string type will not be able to store this much of characters as your code have.
I tried to do the same thing in my demo account and code got truncated. This is why you are not able to see all 4 block in the rendering.
I would like to suggest a possible solution. Could we consider adding the following section to the source code(wherever required) in the CRM: "?aid=${lead.accountid_account}". This should ensure that when the token is passed to Marketo, it will function correctly.
Thanks!
As Saurabh says, you’re deliberately truncating the data — though you may not be thinking of it this way — by using Change Program Member Data since you have to be using a String, not Textarea. (There’s no such think as a Textarea PMCF.)
A String can hold up to 512 ASCII characters using some crafty code, but it’s never gonna fit the 3000+ characters in your example.
I’d go about this a different way. You don’t need a PMCF. Leave the HTML code in the Text {{my.token}}. Output the Text {{my.token}} in-between two VTL tokens with #define
and #end
statements (the “defineburger” technique). Then you can access the HTML as a Velocity string, i.e. with no length limit.
This assumes, of course, that you can’t change what your CRM puts in the {{my.token}}. On that note, what CRM are you using that’s able to update {{my.tokens}} natively? Salesforce can’t do that and pretty sure Dynamics can’t either. It would have to be custom code.