- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 12:32 AM
Good day, how would I fulfil the below requirement.
When an incident is set to status 'Resolved' the related case should be populated with:
Resolution Code = Solved
Related Request is Closed Complete
Resolution Notes = The related request has been closed
Set Case to Phase - Propose Solution.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 02:17 AM
This is the code that worked for me.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord('sn_customerservice_case');
gr.addEncodedQuery('incident='+current.sys_id);
gr.query();
while (gr.next()) {
gr.cause = current.getDisplayValue('close_code');
gr.close_notes = current.close_notes;
gr.resolution_code = 16;
gr.state = 6;
gr.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 12:42 AM
Hi,
you can use after update BR on incident table
Condition: State Changes To Resolved
Query Case table with the current INC and update it
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
04-01-2022 01:01 AM
Thanks Ankur,
I'm guessing this will be with a script.
Would you be able to guide me with that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 01:31 AM
I have something like this, but not sure if it will work.
(function executeRule(current, previous /*null when async*/) {
var caseGr = new GlideRecord("sn_customerservice_case");
caseGr.addQuery("incident",current.sys_id);
caseGr.addActiveQuery();
caseGr.query();
while(caseGr.next()) {
caseGr.resolution_code = 21; // Solved – Related Request is Closed Complete
caseGr.close_notes = 'The related request has been closed';
caseGr.state = 6; //Resolved
caseGr.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 02:18 AM
OOB case table doesn't have incident field
please use correct field on case table to query; may be you are using parent field
OR
if you are storing case sysId in incident; then query case table with that sysId and update
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader