Single text variable should get display depend on selection of choice list under service catalog

Manu143
Tera Contributor

Hi Community,

  I need urgent help on: I have requirement that I need to introduce new single text variable under service catalog, this single text variable should be visible only when certain categories (e.g - if I chose  one purchase category single text variable should get display  there below that particular purchase category ,if I chose 2 another one should be below second purchase category and so on) are chosen from the choice list. Single variable text field Should hard stop because we should be able to enter 10 characters – no more – no less In Alpha numeric sequence.  

 

 

 

Thanks,

Manu

 

 

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Manu143 

there are 2 things here

1) visibility of that variable based on another variable i.e. Purchase category

2) validation of input

what did you start with and where are you stuck?

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

Hi Ankur,

  As of now I have just created single text variable and Iam not getting the further approach how to handle the requirement. Like I have to use catalog client script to hide and display depend on choice list selection or what.

Thanks,

Manu

Hi @Manu143 ,

To restrict the variable for 10 characters , when you configure the variable there is a field named "variable attribute" there you can specify max_length=10 

To hide/show the variable , if you have static value of Purchase category you can create a UI Policy to hide and show the variable.

 

Please mark helpful/correct if my response helped you.

Chaitali_Vale
Mega Sage
Mega Sage

Hello @Manu143 ,

 

First create 2 variables which type is single line text and the max length should be 10.

For that follow the below steps :

1. 

Chaitali_Vale_0-1697612792496.png

2. 

Chaitali_Vale_1-1697612854983.png

3. 

Chaitali_Vale_2-1697612878409.png

4. 

Chaitali_Vale_3-1697612907012.png

 

Now create 2 different UI policies : 

1. 

Chaitali_Vale_4-1697613003277.png

2.

Chaitali_Vale_5-1697613024220.png

 

For alpha numeric sequence refer bellow link : 

https://www.servicenow.com/community/service-management-forum/how-can-i-restrict-a-field-to-accept-a...

 

Please mark my answer correct or helpful, if applicable.

Thanks & regards,

Chaitali Vale