Need to populate problem record in related records of Incident form

srinidhi
Tera Guru

Hello All,

 

Whenever major incident is created, problem record will be auto generated. Now that Problem record should be auto populated in related records. Can you please help me in this. Thanks.

 

srinidhi_0-1676399166449.png

 

1 ACCEPTED SOLUTION

Manoj R Zete
Tera Expert

Hi Srinidhi,

 

have a before insert business rule on incident with condition as priority is p1

have below script in the business rule

var gr = new GlideRecord('problem');
gr.initialize();

// map whatever fields you want here from incident to problem

gr.description = current.description;
var sys_id = gr.insert();

current.problem_id = sys_id;

 

Regards

Manoj

View solution in original post

3 REPLIES 3

Manoj R Zete
Tera Expert

Hi Srinidhi,

 

have a before insert business rule on incident with condition as priority is p1

have below script in the business rule

var gr = new GlideRecord('problem');
gr.initialize();

// map whatever fields you want here from incident to problem

gr.description = current.description;
var sys_id = gr.insert();

current.problem_id = sys_id;

 

Regards

Manoj

SatyakiBose
Mega Sage

Hello @srinidhi 

This should be pretty simple.

There are many OOB UI actions which you can refer to, to get this functionality.

 

One such UI action you can refer to is : Create problemhttps://xxxxxx.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=2f43c471c0a8006400a07440e49924c...

If you see line 3 of this UI action it calls:

current.problem_id = prob.insert();

This is what will help you insert the value in the desired field.

 

Thanks for the reply, checking on this.