MRVS

HARSHA GOWDA R
Tera Contributor

HARSHAGOWDAR_0-1771315623126.pngHARSHAGOWDAR_1-1771315643048.png

I cloned the out-of-the-box widget to capture MRVS values when a request is submitted. However, the values entered by the user are not being captured on submission, and the custom portal throws an error.

If I switch back to the OOTB widget record, it works correctly. But when I use the cloned custom widget, the error occurs and the MRVS values are not captured.

Will MRVS work properly in a custom scoped application?

4 REPLIES 4

sivasankaris
Tera Guru

Hi @HARSHA GOWDA R ,

The error Cannot call property size in object... It is not a function, it is "number" is the smoking gun. In the ServiceNow Global scope, certain objects use .size() (a function), but in a Scoped Application, those same objects often use .size (a property) or .getSize().

 

The Fix

In your cloned widget's Server Script, look at Line 170. You need to change the way you check the size of the choiceListQuantity object.

Change this: for (var i = 0; i < choiceListQuantity.size(); i++) {

To this: for (var i = 0; i < choiceListQuantity.size; i++) {

 

If this works, Please Mark it as helpful and please Accept My Solution..

Best Regards,

SIVASANKARI S

Hi @sivasankaris 
I already tried changing size() to size but its not working

Tanushree Maiti
Mega Sage

Hi  HARSHA GOWDA R

 

Check this thread: You have to do  several changes as per the post:

 

1. choiceListQuantity.size instead of choiceListQuantity.size()

2.choiceListQuantity.getChoice(i) instead of choiceListQuantity.get(i)

3. (isFinite(choice.getValue())) instead of (!isNaN(choice.getValue()))

4. lines 195 to 198: 

data.sc_cat_item = $sp.getCatalogItem({
sys_id: data.sys_id + '',
is_ordering: true
});

Replace it with data.sc_cat_item = $sp.getCatalogItem(data.sys_id);

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@HARSHA GOWDA R 

what's your requirement here?

why you did cloning?

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