Setting fields to read-only in UI Action

ceraulo
Mega Guru

Hello!

I am creating a UI Action wherein clicking the UI Action would set some fields to read-only and other fields to editable.
Is there a way to do this?

Please help!

Thank you.

1 ACCEPTED SOLUTION

Hi,

If those fields are made read only at dictionary level or through ACL then you won't be able to make it editable by UI action. Check what making it read only.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

14 REPLIES 14

Hi,

you want to make it readonly or editable

your script is wrong; I mentioned it should be readOnly true

g_form.setReadOnly('field', true);

regards
Ankur

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

Hi @Ankur Bawiskar 

The script is correct. Currently, these fields are read-only. These should be editable once the UI is clicked.

The UI Action requirement is a combination of setting fields to read-only or editable.

Hi,

If those fields are made read only at dictionary level or through ACL then you won't be able to make it editable by UI action. Check what making it read only.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Thanks! The cuprit was ACLs for all the fields I wanted to update. As a workaround, I created a true/false field. I set this true when the UI action is clicked, and used this custom field in the ACL.

Hi,

are those fields readonly via dictionary level

OR

are those fields read-only via field level WRITE ACL

If ACL is there then you cannot use g_form

Regards
Ankur

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