
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 04:13 AM
Hi,
As my scripting abilities are somewhat lacking, I have a scenario where I need to email the user defined by a catalog variable, call it user_affected, after the task has been completed. In the workflow, I have added the notification tile, and tried the following in the advanced script:
// Set the variable 'answer' to a comma-separated list of user or group sys_ids that you want the email sent to.
answer = [];
var user = current.variables.user_affected;
answer.user;
Unsurprisingly, it didnt generate an email to the answer for user_affected. Where am I going wrong please. Note the user_affected would be a record on sys_user table with a valid email address.
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 04:31 AM
Hi
So its a little difficult to guess what's the issue with only a fraction of the setup, but the correct way to add something to an array like answer, is:
//This is not correct
//awswer.user;
answer.push('some@email.com');
Also the user_affected is probably a GlideRecord? So you would need something like current.variables.user_affected.email to get the email address.
answer.push(current.variables.affected_user.email);
Hope it makes sense 🙂
-Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2023 06:34 AM
Hi,
Solution to the email of the user defined by a catalog variable after the task has been completed.
In the workflow add in the script:
// Set the variable 'answer' to a comma-separated list of user or group sys_ids that you want the email sent to.
answer = [];
answer.push(current.variables.variable name.sys_id);
answer.push(current.variables.variable name.sys_id);
Note: Here variable name is a reference field.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Lokesh