Email notification using dot walking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2016 10:44 AM
I'm trying to send a notification when the state of a Change, changes to Scheduled, to each of the users that have an assigned CI that will be affected by said change, I'm trying to dot walk to the related fields, but it doesn't seem to be working. I know the "Task.State" dot walk is not working, because I have tried sending the notification directly using the "changes_request" table and is nomarlly sent; but if I do that I can't access to all the affected CIs, that's why I try dot walking it, but I don't know what's wrong. Any help is appreciated. Couple of screenshots in case they help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2016 11:22 AM
Hi Irving,
I'm not certain, but I don't think it will monitor for events/changes (i.e., insert or update) in another table, even though it is related.
(Reasoning: you are not actually changing a record in [task_ci])
I believe you would want to:
- Write this notification on either your [change_request] table or just the [task] table itself to monitor for when the state changes to your desired value.
(if using [task], beware of other overlapping/conflicting choice values for state on other task types). - Create a mail script that will query [task_ci] to get your affected CI's based on the current record, and then compile a list of recipients.
- Include this mail script in your notification to add those recipients to either the CC or BCC per this notification script example:
Scripting for Email Notifications - ServiceNow Wiki
See if that will work for you.
Thanks,
-Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2016 11:26 AM
Irving,
The reason the notification isn't firing is because it triggers when a record is updated/inserted on task_ci. Since you're wanting the notification to trigger when the change moves to the state of "Scheduled", you're probably going to need to go with creating an event-driven notification.
Here's a link to building business rules to generate events in the event queue: Events and Email Notification - ServiceNow Wiki
Essentially, your notification that you've built will remain mostly the same, but the "Send When" will change to "Event is Fired", and you'll select the event you registered in the event registry.
You shouldn't need to pass any parameters in your case, because the event is essentially just a trigger to get the process flowing. When the event is processed, the notification will pick it up, then send the notification to whomever you have in the recipients list shown in your 3rd screenshot.
The business rule would look something like this (not tested):

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2016 01:37 PM
Hi Irving,
Here's my approach. Build your notification around the change_request state changing to 'scheduled' as you originally planned.
In your notification, you'll need a Mail Script that adds the people from the affected CIs. You'll need to query the task_ci table for all records where the task field is the same as your change_request. Task_ci is a many-to-many table so one reference points to task records (including your change requests) and the other points to CIs. When you have that list of records, you can get at the assigned_to fields on those CIs and construct your recipients via script.
See section 4.5 here: Scripting for Email Notifications - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 01:33 PM
The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: Scripting for Email Notifications
Visit http://docs.servicenow.com for the latest product documentation