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.

Array Difference in Scoped Application

Aaviii
Tera Contributor

Can someone share script to get array difference in Scoped Application

1 ACCEPTED SOLUTION

@Aaviii 

try this

  var arr = new global.ArrayUtil();
    var currArr = current.watch_list.toString().split(',');
    var prevArr = previous.watch_list.toString().split(',');
    var gm = arr.diff(currArr, prevArr);
    gs.info("Test" + gm);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

5 REPLIES 5

Medi C
Giga Sage
Giga Sage
new global.ArrayUtil().diff(a1,a2)

If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.