Tanushree Maiti
Tera Patron

Hi @saint 

 

Add a Script Step to evaluate the overlap and set up the following inputs and outputs:

Inputs:

  • group_a_users: Map this to the sys_id list from your first Look Up Records.
  • group_b_users: Map this to the sys_id list from your second Look Up Records. 

Output:

  • Name: common_users
  • Type: String (or Array.String depending on subflow requirements)

 

Sample code/Not tested:

 

(function execute(inputs, outputs) {

    var arrA = inputs.groupA ? inputs.groupA.split(',') : [];

    var arrB = inputs.groupB ? inputs.groupB.split(',') : [];

    var arrayUtil = new global.ArrayUtil();

    var common = arrayUtil.intersect(arrA, arrB);

    outputs.common_users = common.join(',');

})(inputs, outputs);

 

You can then map this output variable directly to your subflow’s output field

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti