- 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-08-2020 03:56 AM
Hi,
please share your complete script
the below code is server side so you will have to use current object and set the values
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);
}
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-08-2020 08:52 AM
Hey,
On Workspace Client Script
function onClick(g_form) {
g_form.setValue('state', 'closed_complete');
g_form.save();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2020 09:55 PM
Hi,
this should work
Any issue faced?
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-08-2020 11:59 PM
Hi, No, its not working. When Create Incident UI action clicked, it creates incident but Interaction state still shows "Work in Progress". Attached the screenshot. any thoughts on where is the issue? thanks