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

Ankur Bawiskar
Tera Patron
Tera Patron

@Aaviii 

you can use ArrayUtil class and it supported in scoped app

ArrayUtil - Global 

Simply call it using global.ArrayUtil() syntax from other scope

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

It's not returning any value @Ankur Bawiskar   
 
  var arr = new global.ArrayUtil();
    var currArr = current.watch_list.split(',');
    var prevArr = previous.watch_list.split(',');
    var gm = arr.diff(currArr, prevArr);
    gs.info("Test" + gm);

@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

@Ankur Bawiskar  how can i get display value of these?