We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

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

Thanks & Best regards,
Medi