
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2012 07:01 AM
I need to make a catalog item variable mandatory on only one task. I do not need it to be mandatory when submitted, I just need it to be mandatory on one of the tasks that get generated by the workflow.
Thanks for the help.
Jason
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2012 07:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2012 12:11 PM
Hi Jason,
You can create catalog client script to hide this field when this is submitted and after it you can client script attached to a sc_task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2012 08:05 AM
I'm not following you....
I don't care to hide the field - I just need it populated at a certain stage (task) of the workflow. At that point I need it to be mandatory and nowhere else. Once this task has been completed, I should be ok since the variable is now populated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2012 08:51 AM
Take a look at this wiki article. You could use setMandatory() and base it off of some unique attribute of that task, possibly short description if that won't change.
http://wiki.service-now.com/index.php?title=Client_Script_Access_to_Variable_Fields_on_Task_Records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2012 11:44 AM
I'm getting close to the point of having to do the same thing you are and here's what I'm thinking.
Using Workflow Variables, you can show the variables on the appropriate tasks and they must be filled in before the task is closed. They can also be displayed on tasks further down the line if required.
But here's the problem with mandatory variables: you cannot save the record until all those fields contain some data. And it actually affects the RITM record as well, as it will display those workflow variables. What if the techs want to add notes or comments before they even know the answer to the variable? Or have only some of the required data? Can't be done. Well, not OOB at least.
I was thinking of adding some code to the "Save" and "Update" UI Actions that sets "g_form.checkMandatory = false" so that the mandatory field check is skipped before the record is saved. You can have logic to check to make sure the record is in a particular state (i.e. do not skip the check if the user is closing the task, etc...).
I'm going to play around with this to see how it goes. I don't like the idea of using the client scripts because you have to keep adding to the script as you add new variables. Maybe something could be done based on the name of the variable (prefix the names of all Workflow Variables with some string). But you still get into the situation of "we need this variable for this item, but not for that one". Can get pretty hairy real quick.