- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2020 11:43 PM
Hello Guys,
I need to map the priority field on "SC Task" table to the priority field on RITM and REQ table, because the agents will change priority on SC task table( we have 4 choices, critical, high, medium, low) and the same values should be set in the RITM and REQ, for this i thought of creating the new field in REQ and use the same field in RITM and SC task by adding the same field in form layout but the question is how to map the priority change in all the 3 tables based on the priority change in SC TASK,
Can anyone guide me is it correct procedure if not any ideas... and if possible sample script for better understanding, i dont have much idea on scripting.
Thank you!!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2020 11:57 PM
Hi,
There is priority field on task which can be used on RITM and REQ form
For mapping the data you need to use after update BR on sc_task table
OR
You can set the priority field on REQ and then for showing on RITM form dot walk to REQ and show that priority field
BR after update on sc_task
Condition: priority changes && current.request_item.cat_item.name == 'Your Catalog Item Name'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
// update RITM
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.request_item);
ritm.priority = current.priority;
ritm.update();
// update REQ
var req = new GlideRecord('sc_request');
req.get(current.request_item.request);
req.priority = current.priority;
req.update();
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2020 11:57 PM
Hi,
There is priority field on task which can be used on RITM and REQ form
For mapping the data you need to use after update BR on sc_task table
OR
You can set the priority field on REQ and then for showing on RITM form dot walk to REQ and show that priority field
BR after update on sc_task
Condition: priority changes && current.request_item.cat_item.name == 'Your Catalog Item Name'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
// update RITM
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.request_item);
ritm.priority = current.priority;
ritm.update();
// update REQ
var req = new GlideRecord('sc_request');
req.get(current.request_item.request);
req.priority = current.priority;
req.update();
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader