Can I limit the number of entries in a multi row variable set?

jrusso
Tera Expert

I would like to use a multi row variable set to collect direct deposit information, allowing employees to split their deposit into multiple accounts.  However, we would like to limit the number of accounts they can use.  Is there a way to set a maximum number of rows/entries?

1 ACCEPTED SOLUTION

Hi there,

You can set a limit to the number of rows that you can add to a multi-row variable set by using the max_rows attribute in the Variable Set attributes field.

Would that help? Don't see a reason for scripting this like others suggested.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

13 REPLIES 13

Hi there,

You can set a limit to the number of rows that you can add to a multi-row variable set by using the max_rows attribute in the Variable Set attributes field.

Would that help? Don't see a reason for scripting this like others suggested.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks for your help on this Mark.  i have a related question.  We want to validate that the user enters a 9 digit routing bank routing number.  I see that I can set the variable attributes max_length=9, but that doesn't help if someone enters less than 9 digits.  Is there a way to set the attributes on the field to ensure an exact # of digits?

Jaspal Singh
Mega Patron
Mega Patron

Can you try something as below to restrict number of entries. If Variable attribute field does not exist on form you can add it from Form layout.

  This also ensures restriction is applied per Variable set.find_real_file.png

 

 

 

Thanks for your help again.  i have a related question.  We want to validate that the user enters a 9 digit routing bank routing number.  I see that I can set the variable attributes max_length=9, but that doesn't help if someone enters less than 9 digits.  Is there a way to set the attributes on the field to ensure an exact # of digits?

max_length attributes works only for Single-line text, Wide single-line text type of variables.

 

You can write onsubmit client scipt for your catalog item to restrict length less than 9 digits like below using regex

Thanks to @Mark Roethof  for below article

 

https://community.servicenow.com/community?id=community_article&sys_id=78785137dbcbf3801cd8a345ca961...

 

Regards,

Sachin