Workflow Notification (Advanced Script)

Dazler
Mega Sage

Hi,

I am hoping someone can assist me.  I am having a problem with the Advanced Script in the Workflow Notification. I have to send a notification also to the user on the catalog form variable field.  The user is in a reference field, I have tried several things, but it seems to only send an email to the 2nd email after the comma (acessrites@test.com).

I have tried different approaches, but to no avail.

answer = (current.variable_pool.st_employeename.email);

Am I missing something?

 

find_real_file.png

1 ACCEPTED SOLUTION

ARG645
Tera Guru

To understand why its not working, you need to know how recipients list works for the emails in ServiceNow. A recipient list will be filtered for valid email addresses before sending an email. 

So your recipient list according to your code is 

find_real_file.png

So your code should be something like this below 

answer= current.variables.st_employeeemail.email+",acessrites@test.com";

View solution in original post

6 REPLIES 6

Prateek kumar
Mega Sage

try removing quotes, just use current.variables.st_employeeemail (guessing this would be an email?)


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

ARG645
Tera Guru

To understand why its not working, you need to know how recipients list works for the emails in ServiceNow. A recipient list will be filtered for valid email addresses before sending an email. 

So your recipient list according to your code is 

find_real_file.png

So your code should be something like this below 

answer= current.variables.st_employeeemail.email+",acessrites@test.com";

Thank you!  That worked!

Jim Coyne
Kilo Patron

This should do it:

answer = current.variables.st_employeename.email + ",acessrites@test.com";

However, I would suggest that you NOT include the notification directly in the Workflow.  It would be better to raise the event instead and have a Notification respond to that event instead.  This way is easier because any updates to the Notification can happen outside of the Workflow.  If within the the Workflow, you would need to publish a new version of it and any currently running workflows would not get the updates.