SOLVED

Re: Email script token as recipient for sending alert

Go to solution
ggerla
Level 4

Email script token as recipient for sending alert

Hi there, I'm trying to use an email script token as a recipient for an email alert. I'm using this because the choice rules on the Flow are too way restricted for my necessity. The following is an example of what I'm doing.

 

ggerla_0-1689693928667.png

The token itself works correctly: if I use it within the body email, it will be resolved correctly to the correct email address, but if I use it as a recipient, it is not working.  If I'm looking into the log, I can see the step executed correctly, but I'm not seeing the resolved token, just the name.

 

ggerla_1-1689694269713.png

 

The main question is: can I use an email script token as an alert recipient? Second one: why it is not working?

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token as recipient for sending alert

You can’t use Velocity/Email Script tokens outside of emails themselves, i.e. they can’t determine recipients.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token as recipient for sending alert

You can’t use Velocity/Email Script tokens outside of emails themselves, i.e. they can’t determine recipients.

SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token as recipient for sending alert

Please return to your thread and check responses, @ggerla.

ggerla
Level 4

Re: Email script token as recipient for sending alert

Thanks for replying.

Is there another way to manage complex conditions to determine which recipient needs to receive the notification, which shouldn't involve the lead's fields?

Unfortunately, as I said, the choice condition within the flow is not flexible and scalable.

SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token as recipient for sending alert

Only way that comes to mind is calling a webhook-compatible service that applies whatever logic you want and then writes the address to a lead field. That {{lead.token}} is then used in Send Alert. Of course I’d like to see what logic you’re really using, what logic (and non-lead objects) you’re consulting in Velocity.

ggerla
Level 4

Re: Email script token as recipient for sending alert

Thanks for that.

I mean, storing some kind of information at the lead level could be problematic: let's assume that I need to send an alert to internal staff after form submission. 

If I don't want to create multiple triggers evaluating all the conditions, I could create just a single trigger saying if the form is submitted -> send an alert.

Then the condition of the recipient. What about if I need to evaluate, in the same place, the lead country and lead department? Eg: Sales && Spain? Obviously, that can be achieved using a smart list, but for a limited amount of choices; And if I need more complex verifications, how can I do this?

SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token as recipient for sending alert


I mean, storing some kind of information at the lead level could be problematic:


I’m still not hearing what you’re doing in Velocity, for this task, that’s too complex to reproduce with Smart List rules.

 

Can there be logic that’s impossible, or mind-bendingly complex, to do without a programming language like Velocity? Of course! I love Velocity because of its near-infinite power. But do you have such a requirement here?