- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 03:04 PM
Hello
We are on Madrid version. We have requirement to send "Job Well Done" email to Fulfiller and his/her manager when the NPS score is 9 or more.
NPS score is stored on "asmt_metric_result" table and need to dotwalk from there to RITM's fulfiller and his/her manager so the email notification can be sent out. (snaps below)
Is it possible to dot walk on Users or Users Group field from asmt_metric_result table?
Please advise.
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 03:38 PM
So there's a few things about this that could be tricky. The assessment Trigger ID (the record or in your case the RITM) is stored on the asmt_assessment_instance table. The metric value is stored on the asmt_metric_result table. The RITM does not have a fulfiller. Fulfillers are on the sc_task level. There could also be several tasks associated with one RITM. That being said you could use a business rule on the asmt_metric_result table to generate an event with the info needed to send the notification however you would have to use GlideRecord on the sc_task table to find records that have the current.instance.trigger_id as the requested_item to get the fulfillers.
I'm not a fan of the assessment table for these reasons. It is hard to get all the info in one spot needed to build solid logic.
Try creating a business rule on the asmt_metric_result table that fires before a record is inserted and when actual value is greater than 9.
You will also need to create an event in event registry
Fire your notification off the event. There also should be fields on the notification that are called 'Parm 1 contains recipient'
(function executeRule(current, previous /*null when async*/) {
//Record Trigger ID of the Assessment
var record = current.instance.trigger_id;
var fulfiller = '';
var manager = '';
//Find the task that was generated for your RITM
var catalogTask = new GlideRecord('sc_task');
catalogTask.addQuery('request_item', record);
catalogTask.query();
if(catalogTask.next()){
//Set fulfiller and manager to the tasks assigned to and assigned to manager
fulfiller = catalogTask.assigned_to;
manager = catalogTask.assigned_to.manager;
}
//Generate a event. You would have to create 'send.job.well.done' in event registry before doing this. You can pass fulfiller and manager in as parm1 and parm2. Then you should be able to add them to the email notification
gs.eventQueue('send.job.well.done', current, fulfiller, manager);
})(current, previous);
Again I'm not sure if this is the best solution or it is written correctly to your instance specs but it could work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 03:38 PM
So there's a few things about this that could be tricky. The assessment Trigger ID (the record or in your case the RITM) is stored on the asmt_assessment_instance table. The metric value is stored on the asmt_metric_result table. The RITM does not have a fulfiller. Fulfillers are on the sc_task level. There could also be several tasks associated with one RITM. That being said you could use a business rule on the asmt_metric_result table to generate an event with the info needed to send the notification however you would have to use GlideRecord on the sc_task table to find records that have the current.instance.trigger_id as the requested_item to get the fulfillers.
I'm not a fan of the assessment table for these reasons. It is hard to get all the info in one spot needed to build solid logic.
Try creating a business rule on the asmt_metric_result table that fires before a record is inserted and when actual value is greater than 9.
You will also need to create an event in event registry
Fire your notification off the event. There also should be fields on the notification that are called 'Parm 1 contains recipient'
(function executeRule(current, previous /*null when async*/) {
//Record Trigger ID of the Assessment
var record = current.instance.trigger_id;
var fulfiller = '';
var manager = '';
//Find the task that was generated for your RITM
var catalogTask = new GlideRecord('sc_task');
catalogTask.addQuery('request_item', record);
catalogTask.query();
if(catalogTask.next()){
//Set fulfiller and manager to the tasks assigned to and assigned to manager
fulfiller = catalogTask.assigned_to;
manager = catalogTask.assigned_to.manager;
}
//Generate a event. You would have to create 'send.job.well.done' in event registry before doing this. You can pass fulfiller and manager in as parm1 and parm2. Then you should be able to add them to the email notification
gs.eventQueue('send.job.well.done', current, fulfiller, manager);
})(current, previous);
Again I'm not sure if this is the best solution or it is written correctly to your instance specs but it could work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 08:33 PM
Excellent Idea John. Right on dot.
Appreciate your help. Actually I used it like this.
var ritm = current.instance.trigger_id;
var fulfiller = ritm.assigned_to;
var manager = ritm.assigned_to.manager;
I also wrote mail script since I needed additional details from RITM like (Requested for and RITM number etc.) to address in email notification.
Thanks.
Rajan