- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2020 03:50 AM
Hi, When Incident ticket gets created from the Interaction record with "Create Incident" UI action or associate existing record using "Associate Record" UI action - Would want to update the "state" of Interaction to "Closed Complete"
OOB script is:
if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
action.openGlideRecord(inc);
}
Should this be done by using any of this? current.state="closed_complete" or g_form.setValue(state,"closed_complete")
I tried both but it did't work.
I have also added Interaction field in Incident form layout under related record section. How do I update the "related record" in Incident form to update the Interaction number once it gets created from Interaction record. Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 01:28 AM
Hi,
this worked well for me
In Server Side Script
if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
current.setValue('state', 'closed_complete');
current.update();
action.openGlideRecord(inc);
}
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
12-09-2020 01:28 AM
Hi,
this worked well for me
In Server Side Script
if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
current.setValue('state', 'closed_complete');
current.update();
action.openGlideRecord(inc);
}
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
12-09-2020 01:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 01:48 AM
Hi,
something like this
if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
inc.interaction_field = current.sys_id; // use the proper field
current.setValue('state', 'closed_complete');
current.update();
action.openGlideRecord(inc);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader