Really appreciate if someone should help over the validation error that raised while approving the email . Actually we were sending a email from respective account manager and for doing this i have a custom field of account manager to setup a email script token and select this account manager field and upload the custom velocity script of respective account managers to send email dynamcially from respective account manager.
For reference please see the attached screenshot.
Validation error :
Email script token:
Email script code for account manager signatures
Size of code is 15000+
Actually i got some sense around the error and found the size of script is too large but we cannot want to reduce the size of code further becuase they all were Account managers .
Can someone share better alternative to sort this validation issue.
Several points here:
1. Feature Choice. Much as I love Velocity, as you can tell by my many posts here and elsewhere, it is not always the right tool for the task. In this case you have a surely slowly moving dimension in the Account Manager info. Not to say these values do not change, and they can of course change in bulk across many leads (which is when having the change made only in one place, in Velocity, is extremely handy). But they are largely static and because you have so many of them, would be better off stamped in a lead field via a webhook, with the values stored in a simple CSV. I happen to know your company has such a webhook available; talk to Shashank Sharma about it.
2. Size Limits. Velocity's primitive resource governor is a very new thing in Marketo. It has not been accurately documented: it was said originally that it limited script tokens to 5000 lines, but that's observably not the case and it's limited by the bytes of content, roughly 100KB per script. That's actually a ton of code, and from your screenshot it's clear you have a lot of duplication! Every time you repeat "Addy Rishi" you're wasting 10 bytes. Following proper programming practices (not just in Velocity but in general), you should be using a default case here whereunless there's a known exception. That change alone could take you under the limit. You're also repeating keywords like unnecessarily, instead of using HashMaps to do the lookup; that's another thing that not only reduces chaff on the screen, but can keep you under limits. You can read my past blog posts for examples.
3. Multiple Tokens. You can also include more than one large token. But I don't want to encourage that because you should follow best practices first.
4. Comments vs. Code vs. Output. Arguably, you're being unfairly flagged by the resource governor, which (ideally) would be able to tell between a giant block of non-output config data like you have here, and a giant block of pure output which is really what Marketo is trying to protect against so the MIME assembly process doesn't choke. But that would be difficult to detect automatically (ironically, you can output massive data in a loop, which won't be detected) so you just have to deal with it.