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

Community Alums
Not applicable

Yes Ankur.

so which script is doing that?

If field level WRITE ACL is making those fields readonly then script won't work

Regards
Ankur

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

Community Alums
Not applicable

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.

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

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

@Vishwas 

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

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