- 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-04-2022 02:35 AM
Did you mistakenly marked your own response as correct??
The approach of using after update BR was shared in my response.
Would you mind marking appropriate response as correct?
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 03:37 AM
Hi
We have this OOB related list available when a Case is linked to an Incident as shown below:
Please write a After Update Business Rule on Incident Table as per details below:
BR Details:
Table : Incident
When: After Update
Condition: State Changes to Resolved
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery('parent',current.sys_id);
gr.query();
while(gr.next()){
gr.resolution_code = current.getDisplayValue('close_code');
gr.close_notes = current.getDisplayValue('close_notes');
gr.Field_OF_CASE = current.getDisplayValue('close_code');
gr.update();
}
})(current, previous);
This should work for you.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- 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);