Fields are not getting setReadOnly False on cmdb_ci_computer table

Community Alums
Not applicable

Hi @Ankur Bawiskar 

 

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.

9 REPLIES 9

Musab Rasheed
Tera Sage
Tera Sage

Hi Vishwas,

Your requirement is confusing, are fields displayed as read-only all the time or what.? Check dictionary of those fields if they are ready only from there or not.?

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Community Alums
Not applicable

No, they are not read only from dictionary.

Hi Vishwas,

Please check following from where fields might be getting read only.

1) UI policy.

2) Client script

3) ACLs

4) UI action( least likely)

There must be something existing which is making them readonly and mostly through ACLs please check thoroughly.

Please hit like and mark my response as correct if that helps
Regards,
Musab

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

You are making them editable using onLoad client script for group members

So are those fields readonly by default when form loads?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader