Server JavaScript error Cannot call property size in object com.glide.script.fencing.ScopedChoiceList. It is not a function, it is "number".

Community Alums
Not applicable

I am using the OOB widget SC Catalog Item and cloned to different scoped application. I am getting an error when I am using that widget.

Did anyone faced the same issue? Could you please provide your inputs?

When I check the logs on choiceListQuantity and got an error as mentioned below.

com.glide.script.fencing.ScopedChoiceList

Part of Script from widget:

var clGenerator = new GlideChoiceList();
var choiceListQuantity = clGenerator.getChoiceList("sc_cart_item", "quantity");
var choicelistQuantityData = [];
for (var i = 0; i < choiceListQuantity.size(); i++) {
var choice = choiceListQuantity.get(i);
if (!isNaN(choice.getValue()))
choicelistQuantityData.push({value : parseInt(choice.getValue()), label : choice.getLabel()});
}

1 ACCEPTED SOLUTION

CA4
Kilo Expert

I am dealing with the same issues...

You need to remove the () from after the size (so choiceListQuantity.size not choiceListQuantity.size()).

You are also going to have an issue with choiceListQuantity.get(i), it should be choiceListQuantity.getChoice(i). 

I am now running into another issue with this widget where the selected item is not showing in the form.  When I figure out the issue I'll let you know.

View solution in original post

5 REPLIES 5

nick32
Giga Contributor

Thank you so much for your guidance.