'Create Incident' UI action in Interaction form (Agent Workspace UI)

Vinay52
Tera Expert

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 

 

1 ACCEPTED SOLUTION

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

This worked fine, Thanks

How do I add the Interaction number from which incident generated in Related record when same UI action clicked? 

 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader