Mandatory field is not able to control via on change choice field

rajeshraji1
Tera Expert

On change Catalog item

variables string filed like : Field1 ,field11,filed2,field22,filed3,field33  there are six string filed .

and choice field : name : select value 

choice value : none,0,1,2,3.

 

Scenario :

1.When i select none and 0 no one filed populate all the field need to hide .

2. Then If i selected choice value 1 the Field 1 and field11 this field need to visible and need to set mandatory rest of the fields need to Hide .

3.Then if i select choice value 2 then Field1 , field11 and filed2 , field22 these four field need to visible and set mandatory rest of the fields need to Hide .

4.Then if i select choice value 3 then Field1 , field11 and filed2 , field22 , field3 , field33  these six field need to visible and set mandatory for six field .

 

and main thing is these conditions are need to apply task view as well.

 

Note : if on change is not good practice the suggest any other method to archive this .

 

1 ACCEPTED SOLUTION

J Siva
Tera Sage

Hi @rajeshraji1 
Create Catalog UI policies as below.

 

1. When Choice value is 1 or 2 or 3: In the Catalog  UI policy action, add Field 1 and Field 11 (Make mandatory and Visible as true)

2. When Choice value is 2 or 3:In the Catalog UI policy action, add Field 2 and Field 22  (Make mandatory and Visible as true)

3. When choice value is 3:  In the Catalog  UI policy action, add Field 3 amd Field 33  (Make mandatory and Visible as true)

Sample UI policy:

JSiva_1-1745465586390.png

JSiva_2-1745465656318.png

 

 

 

In the Catalog  UI policies check the below highlighted check boxes.

JSiva_0-1745464948782.png

Hope this helps.
Regards,
Siva

View solution in original post

5 REPLIES 5

@rajeshraji1 

what debugging did you perform with the client script I shared?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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