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.

Related to Service catalog on visibility and mandatory fields

varshajain
Tera Expert

In my service catalog, i have two select box field, for eg, 1 . is categery which has two options anad 2. is sub category which has 5 options.
now based on these conditions , the form visiblity and mandatory should work according.
Like it becomes 10 conditions on this, most of the variables are common and its visibilty and mandatory works on different cases.
I worked with UI policy and Client scripts and it is not working as expected.
How can I achieve this, and variables whose visibilities I need to do has almost 12 -1 5 variables.

10 REPLIES 10

Hi
I have provide the requirement.
Thanks
Varsha 

Ankur Bawiskar
Tera Patron
Tera Patron

@varshajain 

unless you share we can't help much.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

varshajain
Tera Expert

I have two fields training type and format of training here,

whenever training type and format of training changes, the title duration and description and many such fields should visible and vice - versa and mandatory also.

I worked with UI policy and applying with AND conditions also, I checked reverse if false option also. But didn;t work as expected.

For eg. Course duration should visible and mandatory only when new training and virtual classroom only . and course description should mandatory only when existing and e- learning selected, should visible when new training  and e- learning and virtual classroom is selected.

Hi @varshajain ,

 

You can easily achieve this using UI Policies. Verify UI Policy conditions. Make sure to verify any conflicts with UI Policy Actions (If two UI policy is working on same field with same order it can give unexpected results) and change the order of execution to resolve it.

 

You can also consider using client scripts, if your requirement is complex or to avoid conflicts.

 

If your issue still not resolves, provide screenshots of your UI Policies with clear expectations and what thing are not working.

 

Thanks

Anand

@varshajain 

I will suggest to create 2 onchange client scripts i.e. 1 for Training Type and other for Format

Then in each of the scripts check the value of other variable and accordingly show/hide other variables and make them editable/readonly etc

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader