Edgar Valdés
09/15/2021, 6:51 PMjarens
09/15/2021, 7:21 PMvar employeeSearchObj = search.create({
type: "employee",
filters:
[
],
columns:
[
search.createColumn({
name: "entityid",
summary: "GROUP",
sort: search.Sort.ASC,
label: "Name"
}),
search.createColumn({
name: "internalid",
join: "transaction",
summary: "COUNT",
label: "Internal ID"
})
]
});
var searchResultCount = employeeSearchObj.runPaged().count;
log.debug("employeeSearchObj result count",searchResultCount);
employeeSearchObj.run().each(function(result){
// Check if Employee Has Zero Transactions
if(result.getValue({
name: "internalid",
join: "transaction",
summary: "COUNT"
}) === 0){
//Do something
}
return true;
});
jarens
09/15/2021, 7:21 PMMike Robbins
09/15/2021, 7:25 PM["count(transaction.internalid)", "equalto", "0"]
and only return employees with no transaction rather than returning all employees and filtering out those with transactions.Edgar Valdés
09/15/2021, 9:40 PM