when incident priority is p5 , problem priority should be p4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2022 04:59 AM
Hi team,
when incident priority is p5 , im creating creating problem ,but problem priority its taking p5 , same has incident,
need to change if incident is p5 , then problem priority should be p4.
im using UI Action : Create problem.
var prob = new GlideRecord("problem");
prob.short_description = current.short_description;
prob.description = current.description;
prob.cmdb_ci = current.cmdb_ci;
prob.priority = current.priority;
if(current.priority == 5)//// im using this if condion hear
{
current.urgency=2;
current.priority=4;
}////// its not working how can i do this .
prob.company = current.company;
prob.sys_domain = current.sys_domain;
prob.u_category = current.category;
prob.u_subcategory = current.subcategory;
prob.u_impact = current.impact;
prob.assignment_group = current.assignment_group;
var sysID = prob.insert();
current.problem_id = sysID;
var mySysID = current.update();
gs.addInfoMessage("Problem " + prob.number + " created");
action.setRedirectURL(prob);
action.setReturnURL(current);
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2022 05:05 AM
hello surya updated the script given now try this with new script below
var prob = new GlideRecord("problem");
prob.short_description = current.short_description;
prob.description = current.description;
prob.cmdb_ci = current.cmdb_ci;
if(current.priority == 5)//// im using this if condion hear
{
current.urgency=2;
current.priority=4;
}////// its not working how can i do this .
else{
prob.priority = current.priority;
}
prob.company = current.company;
prob.sys_domain = current.sys_domain;
prob.u_category = current.category;
prob.u_subcategory = current.subcategory;
prob.u_impact = current.impact;
prob.assignment_group = current.assignment_group;
var sysID = prob.insert();
current.problem_id = sysID;
var mySysID = current.update();
gs.addInfoMessage("Problem " + prob.number + " created");
action.setRedirectURL(prob);
action.setReturnURL(current);
If my answer solved your issue, please mark my answer as ✅ Correct & ????Helpful.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2022 05:46 AM
if(current.priority == 5)//// im using this if condion hear
{
current.urgency=2;
current.priority=4;
}////// its not working how can i do this .
else{
prob.priority = current.priority;
}
this code working for incident priority change after p5 to p3 its chaning no change in problem priority.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2022 05:20 AM
There is already an open thread for same question as below
https://community.servicenow.com/community?id=community_question&sys_id=89791c9bdb82c110bb4a474d139619f5
Do not create duplicate threads for the same requirement.