Fields are not getting setReadOnly False on cmdb_ci_computer table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 12:12 AM
Hi
I want to give access to 3 fields on cmdb_ci_computer table. so wrote BR and Client script for it. Also I tried with ACL with script but it is not working will you please help me in this. In client script I tried with role aslo but it is getting ReadOnly False.
Client script:
function onLoad() {
// if (g_scratchpad.isMember.toString() == 'true') {
if (g_user.hasRole('cmdb_user')) {
g_form.setReadOnly('assigned_to', false);
g_form.setReadOnly('assignment_group', false);
g_form.setReadOnly('x_fls_flexera_fnms_calculated_user', false);
}
}
BR:
(function executeRule(current, previous /*null when async*/) {
//g_scratchpad.isMember = gs.getUser().isMemberOf('CMDB Access');
g_scratchpad.isMember = gs.getUser().isMemberOf('7bb7b0861b220d90e4df4229bc4bcb3d'); // CMDB Access
})(current, previous);
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 12:42 AM
Yes Ankur.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 01:58 AM
so which script is doing that?
If field level WRITE ACL is making those fields readonly then script won't work
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 02:34 AM
I also don't know. I think it is OOB.
I have tried with ACL also for specific field with below script.
if(gs.getUser().isMemberOf('CMDB Access')) {
answer = true;
} else {
answer = false;
}
but its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 02:40 AM
Hi,
first of all check this
1) Disable your BR and client script and check what's the behavior
2) Check any dictionary override for those fields is making those fields as readonly at dictionary level
3) then activate your BR and client script and debug
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 10:04 PM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader