- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 01:23 PM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 02:33 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 02:33 PM
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