
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2017 03:06 AM
Hi guys,
I'm trying to create problem ticket through P1 INC generation. i want to achieve this by using business rule. Please advise how can i achieve this, response in beginning to end is much appreciated.
Thanks
Prabhat
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2017 09:18 PM
Hi Prabhat,
as deepak.ingale has already suggested with after business rule that will work perfectly.
i am just adding few points here.
if you will create problem from incident then in problem form there is a related list "Incident" when ever some Problem get created from that incident will attached there.
so here you go try with script below. i tested and it's working perfectly.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var CreateProb = new GlideRecord('problem');
CreateProb.short_description = current.short_description;
CreateProb.cmdb_ci = current.cmdb_ci;
CreateProb.impact = current.impact;
CreateProb.urgency = current.urgency;
CreateProb.priority = current.priority;
CreateProb.company = current.company;
var sysID = CreateProb.insert();
current.problem_id = sysID;
current.setWorkflow(false);
var mySysID = current.update();
gs.addInfoMessage("Problem " + CreateProb.number + " created");
})(current, previous);
I used condition in business rule "When to run" tab.
To show the message either you use "Action" tab or gs.addInformMessage() function in script. so i used both of them.
Final Result
Hope it will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2017 04:06 AM
You can write down after update / Insert BR on incident table with condition like
current.priority.changes() && current.priority == 1
Script Part :
var prob = new GlideRecord('problem');
prob.short_description = current.short_description;
var sysID = prob.insert();
current.problem_id = sysID;
You can refer to "Create problem" UI Action on incident table for more information.
<instance_name>/sys_ui_action.do?sys_id=7cc54e94375e0e00c5486ec2b3990ec2&sysparm_view=ess
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2017 07:54 AM
Condition: StatChanges to Resolved and Priority is 1 // At the Time of incident resolution if the incident is a P1 then problem record will be created
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.problem_id==''){
var prb=new GlideRecord('problem');
prb.u_ci_category=current.u_ci_category;
prb.u_ci_sub_category=current.u_ci_sub_category;
prb.u_ci_affected_app_infra=current.u_ci_affected_app_infra;
prb.short_description=current.short_description;
prb.description=current.description;
prb.priority=current.priority;
prb.assignment_group=current.assignment_group;
prb.assigned_to=current.assigned_to;
prb.insert();
gs.addInfoMessage('New Problem Record '+prb.number+ ' has been created');
current.problem_id=prb.sys_id;
}
else{
gs.addInfoMessage('A problem '+current.problem_id.number+ ' is already created for this incident');
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2017 09:18 PM
Hi Prabhat,
as deepak.ingale has already suggested with after business rule that will work perfectly.
i am just adding few points here.
if you will create problem from incident then in problem form there is a related list "Incident" when ever some Problem get created from that incident will attached there.
so here you go try with script below. i tested and it's working perfectly.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var CreateProb = new GlideRecord('problem');
CreateProb.short_description = current.short_description;
CreateProb.cmdb_ci = current.cmdb_ci;
CreateProb.impact = current.impact;
CreateProb.urgency = current.urgency;
CreateProb.priority = current.priority;
CreateProb.company = current.company;
var sysID = CreateProb.insert();
current.problem_id = sysID;
current.setWorkflow(false);
var mySysID = current.update();
gs.addInfoMessage("Problem " + CreateProb.number + " created");
})(current, previous);
I used condition in business rule "When to run" tab.
To show the message either you use "Action" tab or gs.addInformMessage() function in script. so i used both of them.
Final Result
Hope it will help you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2020 01:38 AM
@Harshvardhan Today I refereed this Thread. Tried this scenario in my PDI.
can you please explain me in brief why we have used
current.setWorkflow(false);
var mySysID = current.update();
here.
Thanks