Why Doesn't Mandatory Property Apply to Variable with Widget in Service Catalog?

jmiskey
Kilo Sage

We are building a Service Catalog for the Service Portal.   We have a Multiple Choice Variable where the user selects a Telecom Service.   One of these services is a new Mobile Device.   We have a Variable in our Catalog Item for the user to select which Mobile Device they would like.   We originally set it up as a Multiple Choice Variable, but that was rather ugly, since many (but not all) of the options have verbose descriptions.   So we instead created a Widget, that lists each option, and has the description indented under each one.

While this looks great, we have encountered an issue.   The Variable itself is not visible until the user selects the New Mobile Device option (from the Telecom Service Variable).   We have a Catalog UI Policy which makes this New Mobile Device Variable (with Widget) visible if this option is selected.   In the same Catalog UI Policy which makes these Variable visible, we also set the Mandatory property on it to be True.   While this worked when the Variable was a Multiple Choice Variable, now that it is Widget (Macro with Label Variable), the Mandatory property does not seem to do anything.   The user can make can submit the request without actually select a New Mobile Device option, and it incorrectly accepts it.

Why doesn't the Mandatory property work for these Variables with Widgets?   How can make this Mandatory?

Thanks

6 REPLIES 6

ohhgr
Kilo Sage
Kilo Sage

Hi Joe,



I'm stuck with the same issue, did you find a solution to it?



-Mandar


We ended up scrapping the Widget idea altogether on this one.



Instead, we set up a table with the various columns, including the Device type and the Description.


We then set up this field in the Service Catalog as a Reference field, and returned both columns by filling out the "Variable attributes" section on the "Default Value" tab which an entry like this, which shows both columns that we want to see ("option" and "notes"):


ref_auto_completer=AJAXTableCompleter,ref_ac_columns=option;notes,ref_ac_columns_search=true,ref_ac_display_value=false



Then, since it is not a widget, the Mandatory policies work just fine.


Thanks for the reply Joe.



As Chris has pointed out, the glideFormFieldsFactory, returns false when isMandatory() function is called by g_form's submit() function. We are thinking of adding an additional check for making a customary mandatory check.



Thanks again.


-Mandar


ChrisBurks
Mega Sage

Hi Joe,



The fact that it's a Macro/Widget is why it doesn't make the "variable" mandatory. You'll also notice that it's not possible to make a variable mandatory from within the variable editor once the type is changed to "Macro".


And the reason is that once "Macro" is selected the system now determines that you will make something custom. The system won't know how many input fields within that "one variable" will be created, if any. Let alone what the id's are going to be if any are applied.



You will have to make the fields mandatory within the widget itself as well as script it to communicate this requirement to the Service Portal widget containing the submit button.