Workaround for Velocity loading Java libraries | Community
Skip to main content
Level 1
September 18, 2019
Question

Workaround for Velocity loading Java libraries

  • September 18, 2019
  • 2 replies
  • 4049 views

I use a basic method for hashing data for linking to customers (sending them a URL that points to a survey for recent service, for example). This process uses base64 and string2hex, both of which are native to the SalesForce Marketing Cloud application (we are still running on SFMC and currently migrating to Marketo).

I am currently working on replicating this functionality in Marketo, but unfortunately due to the recent removal of classtools and contexttools from Velocity, we can no longer accomplish this as far as we understand it. From my understanding, Java Utilities is where that functionality was accomplished in Velocity and we simply cannot load those encryption libraries any more. I have been playing with email-script-tokens and webhooks all day with zero success. I then found this article (https://nation.marketo.com/community/product_and_support/blog/2018/07/17/sha-256-ing-an-email-address-in-velocity) and tried to re-engineer the code for my purpose, but again with no avail. And then I saw at the bottom of that article/comments that loading java libraries is no longer supported with the loss of classtools and contexttools.

Got an error message in my account when I was building an email-script-token: Unsupported Velocity Tools in your Email Script MyTokens

https://nation.marketo.com/docs/DOC-6953

We need a valid method for encrypting data within Marketo during time-of-send and would like to avoid processing this data in another application (more storage, more API calls). Any pro-tips or workarounds would be very helpful if available!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

SanfordWhiteman
Level 10
September 18, 2019

You have to call a webhook-compatible service for this now. I was very sorry to see it go, as were our clients.

sean-16Author
Level 1
September 19, 2019

Thank you for your response, @Sanford Whiteman. I don't think that will work for my use-case. We need the processed data to go to a custom object and from my understanding, web hooks do not support that.

SanfordWhiteman
Level 10
September 19, 2019

Correct, you can't pass CO data to a webhook. We actually have 2 clients passing CO data to an SMTP-to-HTTP gateway via alerts, then updating CO fields via REST API.

Works, not easy on API calls of course. You'd be better off setting the fields at the start if you can (even by setting up an API Gateway that changes the payload on the fly as the COs are created.)

Tony_Mayse
Level 2
October 8, 2019

One other option, if you have the time, would be to implement hexadecimal conversion and base64 encoding directly in Velocity. It might be overkill, but I believe (meaning I haven't tired it myself) it's possible.

The algorithms to accomplish each of these tasks are described clearly here:

Neither of these links is hosted by Marketo: caveat emptor.

Each algorithm is pretty simple. You'll likely need MathTool (VelocityTools 3.0-SNAPSHOT API)  for both tasks.

Also, consider if hex encoding is actually necessary. In many cases, a decimal format can also be used.