How to make variable in Record Producer read only using catalog client script

mballinger
Mega Guru

Hello,

I have a record producer with some attachment fields. I need to make them read only through an onLoad() catalog client script. I currently have a script and script include that I am using to set multiple fields to read only. This is working great, but it does not work on the attachments variables. 

This is what I have:

g_form.setReadOnly('reason', true);
g_form.setReadOnly('solution', true);
g_form.setReadOnly('attachment_1', true);
g_form.setReadOnly('attachment_2', true);
g_form.setReadOnly('attachment_3', true);

Thanks!

1 ACCEPTED SOLUTION

Martin Ivanov
Giga Sage
Giga Sage

If they are mandatory, you have to first set them to non mandatory (g_form.setMandatory('attachment_3', false)), and then set them read only.

Mark Correct AND Helpful if appropriate. Thanks


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

View solution in original post

1 REPLY 1

Martin Ivanov
Giga Sage
Giga Sage

If they are mandatory, you have to first set them to non mandatory (g_form.setMandatory('attachment_3', false)), and then set them read only.

Mark Correct AND Helpful if appropriate. Thanks


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024