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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

yes it should be possible provided your UI action is client side

g_form.setReadOnly('field', true);

Regards
Ankur

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

Vijay Balotia1
Tera Guru

Hi 

Make UI Action client callable and use g_form.setReadOnly('fieldname', true);

suvro
Mega Sage
Mega Sage

Yes thats possible use similar scripts that you use in Client Script

Just define a method name in onClick field and write the script inside that method as shown below

find_real_file.png

ceraulo
Mega Guru

@Ankur Bawiskar @Vijay Balotia @suvro 

I tried your suggestion but it does not work. It is client callable (Client checkbox is checked).

find_real_file.png