Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Creation of Problem after Major incident state is resolved.

Atchutaram
Tera Contributor

Hi Everyone,

                        I have been working on requirement, so when a major incident is resolved a problem record should be created. Currently i wrote a after business rule  for it. But the problem ticket is not being attached to the related lists of the Major Incident and Vice versa.

Here is the code:  

 

var shortdes = current.short_description;
var assignment = current.assignment_group;
if (current.priority == 1 && current.state == 6 /*You can add the exact condition whatever that says the record is Major Incident.*/ ) {
var prob = new GlideRecord('problem');
prob.short_description = shortdes;
prob.assignment_group = assignment;
prob.insert();
gs.addInfoMessage(prob.number + " Problem ticket has been created through Incident Record");
}

How can i achieve this?

1 ACCEPTED SOLUTION

Astik Thombare
Tera Sage
Tera Sage

Hi @Atchutaram ,

 

Please use below script and write before business rule instead of after as we are updating current object 

 

var shortdes = current.short_description;
var assignment = current.assignment_group;
if (current.priority == 1 && current.state == 6 /*You can add the exact condition whatever that says the record is Major Incident.*/ ) {
var prob = new GlideRecord('problem');
prob.short_description = shortdes;
prob.assignment_group = assignment;
var sys_id = prob.insert();
current.problem_id = sys_id;
gs.addInfoMessage(prob.number + " Problem ticket has been created through Incident Record");
}

 

 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

 

Thanks,

Astik

View solution in original post

1 REPLY 1

Astik Thombare
Tera Sage
Tera Sage

Hi @Atchutaram ,

 

Please use below script and write before business rule instead of after as we are updating current object 

 

var shortdes = current.short_description;
var assignment = current.assignment_group;
if (current.priority == 1 && current.state == 6 /*You can add the exact condition whatever that says the record is Major Incident.*/ ) {
var prob = new GlideRecord('problem');
prob.short_description = shortdes;
prob.assignment_group = assignment;
var sys_id = prob.insert();
current.problem_id = sys_id;
gs.addInfoMessage(prob.number + " Problem ticket has been created through Incident Record");
}

 

 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

 

Thanks,

Astik