- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 10:07 AM
hi.
can anyone help me with the requirment, i have written business rule for the change state where only change manager can be editable in list view, person who has admin and change manager need to edit the 2 fields, person only with admin should not edit the two values.
i have written before business rule and condition as state changes.
(function executeRule(current, previous /*null when async*/ ) {
if ((current.state == '3' || current.state == '14') && !gs.hasRoleExactly('change_manager')) {
gs.addErrorMessage("You are not authorized to change the state to Closed Successful/Closed with Defects.");
current.setAbortAction(true);
}
})(current, previous);
person with change manager and admin need to editable values of 3 and 4
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 11:21 AM
Finally done
change the script with this if problem still persist then turn off the data policy and try
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = false;
//Type appropriate comment here, and begin script below
var canResolve = true;
var chg = !(g_user.hasRoleExactly('change_admin'));
if ((newValue == "6" || newValue == "7") && chg) {
alert(chg);
alert("You are not authorized to change the state to In Progress.");
canResolve = false;
}
callback(saveAndClose);
}
Ignore the alert message i was using old one
Do Mark Correct and Helpful if it works.
***Mark Correct or Helpful if it helps.***

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 10:38 AM
Hi Sai,
That list_edit ACL I sent on previous post didn't work?
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 10:48 AM
that is making complete fields read only

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 10:52 AM
So you still want make that work from two choice list options.
Right now when you select Closed option from list view what happens?
Does it show data policy error?
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 11:02 AM
admin shouldn't able to select those two and change manager with admin should able to, finallly who ever has change manager they only need to edit those two but not either the admin alone and other roles

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 11:08 AM
Ok so its kind of working for me the code from previous post. but weirdly its working on onHold and the other thing is you might need to turn of data policy working on incident table for closed and resolved state
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var canResolve = true;
var chg = g_user.hasRoleExactly('change_manager');
if ((newValue == "3" || newValue == "14") && !chg) {
//alert(chg);
alert("You are not authorized to change the state to Closed Successful/Closed with Defects.");
canResolve = false;
}
return callback(canResolve);
}
***Mark Correct or Helpful if it helps.***