Catalog Client Script to determine if Variable exists on form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 03:11 PM
I have a catalog item where I only present the one variable on one form, and I want to make it mandatory on a task. The reason is the answer from the tech drives the workflow path. Using a Policy to make it mandatory doesn't work well, as you cannot accept the task without also answering the question.
I thought I had found something with the g_form.hasField option, but alas, it does not seem to allow me to use that on variables.
Any way you can think of that allow me to "say" - Is the variable on the form, AND, has it been assigned to someone? - Then, make it mandatory, otherwise make it not mandatory.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 03:20 PM
Why not create a UI policy and set it to 'Apply to Requested item' and 'Apply to Catalog task' to make it mandatory, so that you dont have to create a script to check if the field exists and then make it mandatory?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 03:26 PM
As I had noted in my question - Using a Policy to make it mandatory doesn't work well, as you cannot accept the task without also answering the variable question. So, people are having to assign it to themselves from a list view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 03:28 PM
Would it be possible for you to check the cat_item field and then make it mandatory?
cat_item will have the sysid of the catalog item.
Please mark this response as correct or helpful if it assisted you with your question.