Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Problem with UI Policy on List type field.

dalewechsler
Mega Expert

I thought this was going to be simple - I created a multi-select list field and configured a few choices to get started, including Other. I simply want a string field to appear (and be mandatory) if "Other" is among the choices selected in the list field, and for the field to not be visible if "Other" is not included as a choice.

When I go to set the condition ("x" Contains "y") I can type in "Other" but it disappears when I save it. Also, when I click the magnifying glass to search for the choices I get an error - see screenshot:

UIPolicyConditionsError.png

I tried changing the table in the UI Policy to Choice (sys-choice) but then the field isn't available. I think this has been asked, but the latest suggestion on that thread was to try a client script. I couldn't get that to work either. Anybody else come across this problem in a multi-select list field on a form? This is on the Change Task form.

Thanks!

1 ACCEPTED SOLUTION

dalewechsler
Mega Expert

I got this to work two ways. Both have drawbacks, but they work (ish). With a UI Policy I got the error mention in the OP because the choices in a list field are stored on the Choice table. So, I tried referencing the change task table which worked, but the functionality changed. I wanted these fields to have a Choice pulldown with None (that I will configure to actually display "-- Select one or more --"). Also, I need to be able to give a group of users access to configure choices and add to list. Using this method, it looks like I'll need to give access to the table for the group. Here are some screenshots that help explain:



Here's the reference section:


ChoiceRef.jpg


Here's the result:



ChoiceRef2.jpg




This is clunky compared to how the other fields work that don't have to have "Other" as a choice with a conditional string field. But this did work in that when I went to configure the UI policy for "Other" and configure the condition: "Destination Group Name contains Other" - Other was there as a choice. But couldn't get the UI policy to actually work yet (problem for another day). Also, when I imitated a user who will be adding these values, clicking on the search icon returned a security error, so will have to provide access to this table - more complexity.




Compared to: (this is how the other fields work)


This way is much easier to add multiples and add new values - and no access issues other than giving Personalize choices on field level and Create on Choice table.


regularchoicevschoiceref.jpg





I ultimately resorted to a client script (one for each field that has Other) and it works very well without having to give access to table for the group that will be adding values or have two fields that function differently than the rest. I just have to remember to change the scripts if the field names change.


View solution in original post

5 REPLIES 5

dalewechsler
Mega Expert

I got this to work two ways. Both have drawbacks, but they work (ish). With a UI Policy I got the error mention in the OP because the choices in a list field are stored on the Choice table. So, I tried referencing the change task table which worked, but the functionality changed. I wanted these fields to have a Choice pulldown with None (that I will configure to actually display "-- Select one or more --"). Also, I need to be able to give a group of users access to configure choices and add to list. Using this method, it looks like I'll need to give access to the table for the group. Here are some screenshots that help explain:



Here's the reference section:


ChoiceRef.jpg


Here's the result:



ChoiceRef2.jpg




This is clunky compared to how the other fields work that don't have to have "Other" as a choice with a conditional string field. But this did work in that when I went to configure the UI policy for "Other" and configure the condition: "Destination Group Name contains Other" - Other was there as a choice. But couldn't get the UI policy to actually work yet (problem for another day). Also, when I imitated a user who will be adding these values, clicking on the search icon returned a security error, so will have to provide access to this table - more complexity.




Compared to: (this is how the other fields work)


This way is much easier to add multiples and add new values - and no access issues other than giving Personalize choices on field level and Create on Choice table.


regularchoicevschoiceref.jpg





I ultimately resorted to a client script (one for each field that has Other) and it works very well without having to give access to table for the group that will be adding values or have two fields that function differently than the rest. I just have to remember to change the scripts if the field names change.