Get all catalog item variables in client script on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:14 PM
Hi,
Is there a client script function that get all catalog item variables?
Something that can be used in a client script (in service portal also) to get all variables and run a certain command like - set all mandatory / read only.
thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:21 PM
Hi,
A common way to do this is to go through all fields like so and set them to Mandatory false:
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setMandatory(fields[x], false);
}
So you could create this as an onSubmit client script on the catalog item, just for the catalog item (so don't check the other boxes for request item and tasks, etc.). Give that a try?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 06:21 AM
Hi @Eli Guttman
This is from several years ago, haha, but I came across it.
If my reply helped guide you Correctly, please mark it as "Accept Solution".
Thanks and I hope all has been well!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!