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.

Display variables n times based on another variable selection

Vaishali 11
Tera Guru

Hi,

 

I have a requirement where if a person selects number of person as 1/2/5, then there are a set of fields that should be visible for 5 times or so. Is this possible to do, if yes how it can be implemented?

 

Thanks in advance!!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Vaishali 11 

you can use MRVS for this.

If user selected 2 let user fill 2 rows of MRVS

If user doesn't enter 2 rows, then you can validate this using onSubmit script.

💡 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

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Vaishali 11 

you can use MRVS for this.

If user selected 2 let user fill 2 rows of MRVS

If user doesn't enter 2 rows, then you can validate this using onSubmit script.

💡 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

Hi @Ankur Bawiskar,

Could you please explain the logic a bit in detail?
So suppose I will be creating 5 different MRVS and then how it will be displayed if the user select number of variable sets as 5?

Also for each variable set's variables they have there own show/hide conditions.

Could you please elaborate a bit in detail?

 

Thanks in advance!! 

@Vaishali 11 

nope, you will have only 1 MRVS

Example: Consider you want a catalog item to create n number of users to be created in sys_user

you will select 3 in drop down in 1st variable

then you will ask user to enter 3 rows in MRVS with all the basic user details name, email, phone etc

You can validate using onSubmit if the rows in MRVS matches the count variable

Note: You cannot create variables on the fly when user is present on catalog form, those variables should be present in backend during creation itself

💡 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

Hi @Ankur Bawiskar ,

How will this logic be done, that if the user selects 3 in the 1st variables the MRVS will be visible 3 times?
Do i need to write any ui policy/client script or specify it somehwere?

Thanks in advance!1