Script to send notification to different email addresses based on variable response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2024 06:58 AM
I have a RITM with a list collector variable with three options, we'll go with A, B, and C for simplicity.
The ask is that a notification is sent that includes all stakeholders so they can reply all and keep a chain of questions/comments together. I built a custom workflow already as they asked for this notification after the first task is closed and fire at the same time as the second (attached pic)
The problem is each option has a slight variance of email addresses. If A is selected a notification needs to a group of email addresses, lets go with groups 1, 2, and 3. If B, 1, 2, and 4. If A and B 1, 2, 3, and 4. If c, 2, 3, 5, 6 and if all selected then email to 1-6.
I am struggling on how to make this work, a script in workflow somehow, a business rule, someone figure a way to pass the string from workflow to a decision table?
All of the above I am not great at yet or know much about as I'm a youngling in my Admin/DEV career. Any suggestions would be appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2024 08:13 AM
Hello @Michelle P ,
for similar kind of issue, please refer to the below link:
https://www.servicenow.com/community/itsm-forum/send-notification-based-on-a-variable-response/td-p/...
If it is helpful, please mark it as helpful and accept the correct solution.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2024 09:07 AM
I read that post and I would need 7 different if conditions on the workflow which I felt was excessive and impractical which is why I was trying, or thought a better answer, to potentially do a single script somehow where it say if variable X is option A send to these people, else if variable X is option A and B send to these, if variable X is option B send to these, if variable X is option C send to these and so on to include each potential combination
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2024 10:46 AM
Hi,
Is you List collector variable referring to a OOB or custom table?
My simple solution would be like:
1. Create a new String field in your referenced table called group emails.(or use existing if you have any unused field).
2. In the new field give all the emails with comma separated .
For Example: For A option input your 1,2,3 email address
Similarly do for all the options
3.Write a script in workflow to trigger the event -
GlideRecord its table and get the values you created for the corresponding options ,Push in a array and get unique values
Parse that value to event.parm1-so you ill get the recipients list for notifications
Please mark my answer helpful/correct if it resolved your query
Thanks