current.setAbortAction(true) doesn't work in script include called by reference qualifier

abrouf
Kilo Sage

current.setAbortAction(true) doesn't work in client callable "script include" called by advanced reference qualifier (javascript:new MembersAssignQueuefields().MembersAssignQueuefields()) pointing to the fields of sys_user_group table. Info message and group name appearing by recognizing the group members but not aborting database operation i,e data is saving by the fields. Any input or suggestions are greatly appreciated.

var MembersAssignQueuefields = Class.create();
MembersAssignQueuefields.prototype = {
initialize:function() {
},
MembersAssignQueuefields:function() {
var grp = new GlideRecord("sys_user_group");
grp.addQuery("name");
grp.query();
gs.addInfoMessage("Group Name:" + current.getValue("name"));
if(!(gs.getUser().isMemberOf(current.name.getDisplayValue()))) {
gs.addInfoMessage('only members of the group can be assigned to these fields');
current.setAbortAction(true);
return false;
}
},
type: 'MembersAssignQueuefields'
};

5 REPLIES 5

abrouf
Kilo Sage

Thank you Sanjiv for your input that really helps. Our intention is to avoid too many business rules, instead using other OOB approaches but I agree this case BR is the best approach.