The CreatorCon Call for Content is officially open! Get started here.

Auto populate field when creating an incident from a UI Action Button

Adam Wood
Tera Contributor

Hi 

I am looking to create an automation where our User Management team can create an incident to report that a user has left the company. My thoughts were create a button on the User form which can be clicked which does the following: 

  • Creates a new incident
  • Sets the Caller to the users name 
  • Sets Category and sub category
  • Populates the Configuration item to the users assets (Each CI has the assigned to field populated with a users name)
  • Enters details into the description field 

I have already created the button on the user form but i am unsure how to complete the above actions 

Any guides or advise is welcome 

Thank you in advance 

Adam 

 

1 ACCEPTED SOLUTION

Bit modification:)

var gr = new GlideRecord('cmdb_ci');
gr.addQuery('assigned_to',current.sys_id);
gr.query();
gr.next();

var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.sys_id;
inc.category = 'addyourcategory';
inc.subcategory = 'addyoursubcategory';
inc.cmdb_ci = gr.sys_id;
inc.short_description = 'addyourdescription';
inc.insert();
action.openGlideRecord(inc);

View solution in original post

7 REPLIES 7

Prasad Pagar
Mega Sage

Hi Adam,

Try below

var gr = new GlideRecord('alm_asset');
gr.addQuery('assigned_to',current.sys_id);
gr.query();
gr.next();

var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.sys_id;
inc.category = 'addyourcategory';
inc.subcategory = 'addyoursubcategory';
inc.cmdb_ci = gr.sys_id;
inc.short_description = 'addyourdescription';
inc.insert();
action.openGlideRecord(inc);

Thank you 
Prasad

 

Bit modification:)

var gr = new GlideRecord('cmdb_ci');
gr.addQuery('assigned_to',current.sys_id);
gr.query();
gr.next();

var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.sys_id;
inc.category = 'addyourcategory';
inc.subcategory = 'addyoursubcategory';
inc.cmdb_ci = gr.sys_id;
inc.short_description = 'addyourdescription';
inc.insert();
action.openGlideRecord(inc);

Need to create    a UI action  to resolve RPA server restart incidents with just one click?

Clicking on the UI action, would fill out the following fields with below values and so this
would resolve the incident with one click:

 

-Assign to:
-Impacted Business Service: 
-Cause code: 
-Closure notes: 
-Status: resolved
-Sub state: Self Recovery

can you please help with script

Onkar Pandav
Tera Guru

Hi you can write below code in UI Action script:

 

var incGr = new GlideRecord('incident');
incGr.initialize();
incGR.caller_id = current.user_name // you can write appropriate field name 

< write code for other requirements >

incGR.insert();

var url = '/incident.do?sys_id=-1';

window.open(url,'_blank'); // if you want to open incident in same window then use self instead of blank