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.

Compare value of list collector

JLeong
Mega Sage

Hi Guys,

Need some assistance here.....

I have a catalog request form that populates a list collector based on some fields selection. I need to hide this list collector if the listed values are exactly the same as the other list collector on the form.

How can I compare 2 list collectors?

Thank you in advance.

Regards,

Jocelyn

 

1 ACCEPTED SOLUTION

Hi,

You should not get that error.

 

For sample purpose : run this code in scripts background and check if this works 

var arrayUtil = new ArrayUtil();
var a1 = new Array("a", "b", "c");
var a2 = new Array("c", "d", "e");
gs.print(arrayUtil.diff(a1, a2));

If this works , then put your sample code also in scripts background and check . 

 

It shoudl work most likely. I would suggest putting some print statement for print list array1 and array2 in your code , it will help you to identify rootcause.

View solution in original post

7 REPLIES 7

Hi,

You should not get that error.

 

For sample purpose : run this code in scripts background and check if this works 

var arrayUtil = new ArrayUtil();
var a1 = new Array("a", "b", "c");
var a2 = new Array("c", "d", "e");
gs.print(arrayUtil.diff(a1, a2));

If this works , then put your sample code also in scripts background and check . 

 

It shoudl work most likely. I would suggest putting some print statement for print list array1 and array2 in your code , it will help you to identify rootcause.

Hi Creativethinker!

Thanks so much for your help, arrayUtil works!

Appreciate your help!!!

 

Regards,

Jocelyn

 

No problem have a great day