g_form.setReadOnly('variable',true); not working in RITM level using on load Client script

Suresh1
Tera Guru

Hi Team,

 

I am using an On Load Client script to set a variable ReadOnly. The field is in the variables section, and it's not setting to readonly.

its silly but could n't figure out what is the issue... I have checked the UI policies, other client scripts and there is no collision happening.

 

Please let me know what could be the issue.

 

Regards,
Suresh

10 REPLIES 10

If this does not work, then check two places

1.catalog client script where applies on ritm  is marked true,

2. acls where it is conflicting with roles.

Community Alums
Not applicable

Hi Suresh,

 

In screenshot you have the set the script as Active = false. Could you please check if the script is Active and use

g_form.setReadOnly('variables.service_da_required',true).

Use the below

g_form.setReadOnly('variables.service_da_required',true);

Regards
Harish

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Suresh,

For fields on the form use g_form.setReadOnly('<fieldName>', true);

For catalog variables use g_form.setReadOnly('variables.<variableName>', true);

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Thanks Ankur.