- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 04:36 PM - edited 03-05-2024 06:21 AM
Hello,
We are running into an issue with a business rule is running but not stopping processing of a ui action.
The before business rule runs when inc category is Broadcast Transmission and assigned group is BCC and state changes. The advanced condition is
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 04:43 PM
I think the solution would be to add this script to the UI action too, so that impacted countries are associated before a problem record is associated.
var gr = new GlideRecord("u_m2m_core_country_incident");
gr.addQuery("u_incident", current.sys_id);
gr.query();
if (!gr.next()) {
gs.addErrorMessage("Please attach all impacted countries to the incident form before updating the incident state");
}
else
{
var item = current.cmdb_ci;
if (JSUtil.notNil(item)) {
var prob = new IncidentUtils().getProblemFromIncident(current);
if (prob != undefined) {
current.problem_id = prob.insert();
if (current.state != IncidentState.RESOLVED) {
current.state = IncidentState.ON_HOLD;
if (current.isValidField("hold_reason"))
current.hold_reason = IncidentState.AWAITING_PROBLEM;
}
if (GlidePluginManager.isActive("com.snc.best_practice.problem.madrid")) {
var problemV2Util = new ProblemV2Util();
problemV2Util.copyAttachments(current, prob);
problemV2Util.copyAttachedKnowledge(current, prob);
}
current.update();
gs.addInfoMessage(gs.getMessage("Problem {0} created", prob.number));
action.setRedirectURL(prob);
action.setReturnURL(current);
} else {
action.setRedirectURL(current);
}
} else {
action.setRedirectURL(current);
gs.addErrorMessage('CI field is required before creating a problem record');
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 04:43 PM
I think the solution would be to add this script to the UI action too, so that impacted countries are associated before a problem record is associated.
var gr = new GlideRecord("u_m2m_core_country_incident");
gr.addQuery("u_incident", current.sys_id);
gr.query();
if (!gr.next()) {
gs.addErrorMessage("Please attach all impacted countries to the incident form before updating the incident state");
}
else
{
var item = current.cmdb_ci;
if (JSUtil.notNil(item)) {
var prob = new IncidentUtils().getProblemFromIncident(current);
if (prob != undefined) {
current.problem_id = prob.insert();
if (current.state != IncidentState.RESOLVED) {
current.state = IncidentState.ON_HOLD;
if (current.isValidField("hold_reason"))
current.hold_reason = IncidentState.AWAITING_PROBLEM;
}
if (GlidePluginManager.isActive("com.snc.best_practice.problem.madrid")) {
var problemV2Util = new ProblemV2Util();
problemV2Util.copyAttachments(current, prob);
problemV2Util.copyAttachedKnowledge(current, prob);
}
current.update();
gs.addInfoMessage(gs.getMessage("Problem {0} created", prob.number));
action.setRedirectURL(prob);
action.setReturnURL(current);
} else {
action.setRedirectURL(current);
}
} else {
action.setRedirectURL(current);
gs.addErrorMessage('CI field is required before creating a problem record');
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 07:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 08:39 AM
To stay on the incident you can use action.setRedirectURL(current);
var gr = new GlideRecord("u_m2m_core_country_incident");
gr.addQuery("u_incident", current.sys_id);
gr.query();
if (!gr.next()) {
gs.addErrorMessage("Please attach all impacted countries to the incident form before updating the incident state");
action.setRedirectURL(current);
}
else
{
var item = current.cmdb_ci;
if (JSUtil.notNil(item)) {
var prob = new IncidentUtils().getProblemFromIncident(current);
if (prob != undefined) {
current.problem_id = prob.insert();
if (current.state != IncidentState.RESOLVED) {
current.state = IncidentState.ON_HOLD;
if (current.isValidField("hold_reason"))
current.hold_reason = IncidentState.AWAITING_PROBLEM;
}
if (GlidePluginManager.isActive("com.snc.best_practice.problem.madrid")) {
var problemV2Util = new ProblemV2Util();
problemV2Util.copyAttachments(current, prob);
problemV2Util.copyAttachedKnowledge(current, prob);
}
current.update();
gs.addInfoMessage(gs.getMessage("Problem {0} created", prob.number));
action.setRedirectURL(prob);
action.setReturnURL(current);
} else {
action.setRedirectURL(current);
}
} else {
action.setRedirectURL(current);
gs.addErrorMessage('CI field is required before creating a problem record');
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 04:49 PM
Hi,
What behaviour are you wanting to achieve? Are you wanting to prevent the problem being created? Its not clear the business process you're trying to solve, and ultimately the issue you're running into technically