- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 07:01 AM
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:24 AM
@Bjarne Nielsen completely agree 😉
CS + GlideAjax can get this one working.
Sample:
Client Script
function onLoad() {
var ga = new GlideAjax('MyIncidentUtils');
ga.addParam('sysparm_name', 'getReassignmentCount');
ga.addParam('sysparm_incidentID', g_form.getUniqueValue());
ga.getXMLAnswer(formLogic);
function formLogic(answer) {
var reassignmentCount = parseInt(answer);
g_form.addInfoMessage('Reassignment count: ' + reassignmentCount);
if (reassignmentCount > 2) {
g_form.addInfoMessage("Count is above 2 - make work_notes mandatory");
g_form.setMandatory("work_notes", true);
} else {
g_form.addInfoMessage("Count is 2 or less - do nothing");
}
}
}
Script Include
var MyIncidentUtils = Class.create();
MyIncidentUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getReassignmentCount: function() {
var incident = this.getParameter('sysparm_incidentID');
var gIncident = new GlideRecord('incident');
gIncident.get(incident);
return gIncident.reassignment_count;
},
type: 'MyIncidentUtils'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 08:35 AM
That is expected, with 'current.setAbortAction(true)'. The update is invalid based on your logic. the info message explains that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 08:40 AM
Hi @nishakumari1 ,
Since you are using current.setAbortAction(true);, it will show 'Invalid update'. But from your code above, you don't need to update count to the previous one because you already stop the execution.
Try below BR with "Before - Update, Condition is 'Assignment group' changes"
Script:
if (current.reassignment_count > 3 && current.work_notes.nil()) { // you can add Comment if you want
gs.addErrorMessage('Please enter comments when changing assignment group for incidents with reassignment count greater than 3.');
current.setAbortAction(true);
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 08:49 AM
Business Rule would not be my approach.
It is not user friendly, since it does not guide the user before submitting the form, and it also can interfere with automatic updates that might be relevant.
Instead I would use a Client Scipt to set Work Notes as Mandatory in the specified scenario.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:24 AM
@Bjarne Nielsen completely agree 😉
CS + GlideAjax can get this one working.
Sample:
Client Script
function onLoad() {
var ga = new GlideAjax('MyIncidentUtils');
ga.addParam('sysparm_name', 'getReassignmentCount');
ga.addParam('sysparm_incidentID', g_form.getUniqueValue());
ga.getXMLAnswer(formLogic);
function formLogic(answer) {
var reassignmentCount = parseInt(answer);
g_form.addInfoMessage('Reassignment count: ' + reassignmentCount);
if (reassignmentCount > 2) {
g_form.addInfoMessage("Count is above 2 - make work_notes mandatory");
g_form.setMandatory("work_notes", true);
} else {
g_form.addInfoMessage("Count is 2 or less - do nothing");
}
}
}
Script Include
var MyIncidentUtils = Class.create();
MyIncidentUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getReassignmentCount: function() {
var incident = this.getParameter('sysparm_incidentID');
var gIncident = new GlideRecord('incident');
gIncident.get(incident);
return gIncident.reassignment_count;
},
type: 'MyIncidentUtils'
});