Needing method to set all variables on a Catalog Item to Non-Mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 10:42 AM
Recently we have opened up the ability on our Catalog Tasks to have additional variables that show up on the back-end after an end user has submitted their initial request.
The issue I am running into currently is if one of my ITIL users wants to go out and pick up a newly submitted ticket that is unassigned and assign it to themselves they must first answer all mandatory variables on the form before they will be allowed to save/update the record.
I have had similar requirements in the past to be able to bypass mandatory fields to update a record on different tables that do not include Service Catalog variables where I have used the following code:
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++)
{
g_form.setMandatory(fields[x], false);
}
The issue here is that the getEditableFields() function does not appear to parse through the variable map.
The only solution to my problem I have found so far on the Community would be to have a UI policy per Catalog Item that just applies the Mandatory value to these variables whenever the Task is being closed. This is something I have to ensure I include on every new Catalog Item going forwards and also retroactively go back and edit all of my previous Catalog Items that also support this functionality. I want to avoid dealing with this kind of overhead if at all possible.
I already have a simple UI Action that lives on my tables that support user/group assignment that allows my ITIL users to click it and the form will automatically assign the ticket to them as well as their preferred assignment group.
Here's the code:
current.assigned_to = gs.getUserID();
current.assignment_group = CMH_assignToMe(current.assigned_to); //Script include that finds their preferred assignment group
current.update();
action.setRedirectURL(current);
Basically what I am looking for is to modify this UI Action to first parse the variable map of whatever variables that exist on the current form and then set all mandatory variables to false just to be able to save and reload the record.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 11:54 AM
Do you have these variables defined as mandatory, then a UI policy makes them not mandatory on the catalog item and RITM, or are they defined as not mandatory, then a UI policy makes them mandatory on tasks, or are you doing something else? I have both of these scenarios, and the way we've allowed someone to claim a task is to simply do it from the Catalog Tasks related list on the RITM. The enforcement of variables defined as mandatory or a UI Policy on task to make variables mandatory does not happen on related list cell edits. You could probably even adapt your UI Action (if needed) to work as a list choice so that they can check a box (or more than one) and choose it from the Actions drop-down without any cell edits.
Another thought is maybe your UI Action can still work from the task form if it queries for the task first, then updates that record rather than updating current. I'm thinking a server script can update a task without enforcing the mandatory variables, so maybe a UI action can act like a server script?