- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 05:08 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 10:06 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 10:06 AM
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