Override Variable Set UI Policy in Catalog Item

Chris M3
Tera Guru

I thought this would work, and I'm confused as to why it doesn't.   In case it matters (which I think it does), we are currently on Berlin.

 

We have a variable set with some common questions for many of our forms.   Occasionally a team will request a subset of those questions, and the practice has been to create a copy of the variable set, removing those questions not needed.   This is because many of the variables might be marked as mandatory, and while we can override this on the form, once it gets to the request item and catalog tasks, these variables would show up as mandatory again.

 

My thought was, what if we created a UI Policy in the variable set to make them mandatory always(no condition), and uncheck the mandatory field in all the variables.   Then, if a particular catalog item doesn't need a variable, a UI Policy with a higher order could override the variable set ui policy, and set it to not required.   However this doesn't appear to work.   (When submitting the form, an error pops up saying the field is mandatory. If visible, it shows marked as mandatory)

 

Do Catalog Item UI Policies get applied before variable set ui policies?   Is there some trick to get this to work?

1 ACCEPTED SOLUTION

Chris M3
Tera Guru

With the help of Dave@Service-now, figured out how to get this done.



In the variable set, make sure all variables are marked as not required in the variable record.


Create a client script in the variable set that runs g_form.setMandatory(field_name, true);   For any fields that you want required by default


In the catalog item that does not need those fields to be mandatory, make a normal UI Policy that sets the mandatory flag to false.   The Client Scripts will get applied before the UI Policy, thus removing the requirement.   No apparent ill effects in the RITM or Catalog Task, other then no indicator in the variables tab that the field was required (Calgary may fix this).


View solution in original post

1 REPLY 1

Chris M3
Tera Guru

With the help of Dave@Service-now, figured out how to get this done.



In the variable set, make sure all variables are marked as not required in the variable record.


Create a client script in the variable set that runs g_form.setMandatory(field_name, true);   For any fields that you want required by default


In the catalog item that does not need those fields to be mandatory, make a normal UI Policy that sets the mandatory flag to false.   The Client Scripts will get applied before the UI Policy, thus removing the requirement.   No apparent ill effects in the RITM or Catalog Task, other then no indicator in the variables tab that the field was required (Calgary may fix this).