mvrs : Need to count number of rows

Patrick Boutet
Mega Expert

I have a catalog item with a multiple row variable set. 

I would like to display (in another field of the form), information related to mvrs data
For example, number of rows.

I tried with onSubmit catalog script on mvrs but found that this kind of script can't access variables outside mvrs.

Do you have any idea ?

11 REPLIES 11

Jaspal Singh
Mega Patron
Mega Patron

Hi Patrick,

 

There are 2 links that I found useful when working with MRVS. You can give it a check as well.

Link 1: should help in your case.

Link 2: Is more of for populating data.

Hi, 

Thanks for the links.

I don't understand how I could achieve what I want using solution proposed by ryanlitwiller 

 "As a workaround on my parent catalog item, I'm setting an attribute on the NOW object that always seems to be accessible in ServiceNow via: 
this.NOW.[myAttributteName] = g_form.getValue("myfield");

then from the MRVS I can call upon the NOW object to get my needed value simply with:

this.NOW.[myAttributteName]

 

I may 'store' mvrs data in NOW object from a mvrs client script

But I need to copy this value to a parent variable in original form. 

 

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could do this through a Business Rule, on insert of your sc_req_item record. Server side doing your calculation or whatever you are after, and updating the variable you've set up for this.

Would that help?

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

Mark Roethof
Tera Patron
Tera Patron

Saw this old solution from almost a year ago. Sounds similar to what you are after.

https://community.servicenow.com/community?id=community_question&sys_id=885b107adb7fffccf7fca851ca96...

Obviously this is to count a certain cell from the rows, though principle is the same. Using a Business Rule to update a variable outside your MRVS with a certain value. In your case, just a row count.

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