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

Values should be true instead of false

The script is correct. These 2 fields need to be editable when the button is clicked.

There are other fields which should be read-only but I did not include in the screenshot.

Can you check if these fields are readonly at dictionary level?

Hi,

g_form.setReadOnly('renewable', true); you have added as false which will not make it read only 

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

@Musab Rasheed 

The script is correct. Those fields should be editable when the UI button is clicked.

There are other fields that will be read-only but I have not added those yet.