Kevin B - Alt
02/08/2024, 4:10 PMvar nextApprover;
var employeeSearchObj = search.create({
type: "employee",
filters:
[
],
columns:
[
search.createColumn({
name: "entityid",
sort: search.Sort.ASC,
label: "Name"
}),
]
});
var searchResultCount = employeeSearchObj.runPaged().count;
console.log("employeeSearchObj result count",searchResultCount);
employeeSearchObj.run().each(function(result){
// .run().each has a limit of 4,000 results
console.log(result.id);
console.log(employeeId);
if(result.id === employeeId){
console.log("Match")
}
return true;
});
console.log("Next Approved id value: " + nextApprover)
Clay Roper
02/08/2024, 4:14 PMreturn true;
in your iterator so it continues looping through more than just the first result.Clay Roper
02/08/2024, 4:16 PMresult.id
when you should be doing result.getValue("entityid")
. Next, what is employeeId
? Is it the internal ID of the employee record, or the same field value of entityid
?battk
02/08/2024, 4:20 PMerictgrubaugh
02/08/2024, 4:22 PMAs for this one in particular, I believe you should be using return true; in your iterator so it continues looping through more than just the first result.If I could go back in time to the start of my SuiteScript career, I would keep a counter of how many times this question/problem occurs.
battk
02/08/2024, 4:33 PMbattk
02/08/2024, 4:33 PMbattk
02/08/2024, 4:34 PMbattk
02/08/2024, 4:37 PMClay Roper
02/08/2024, 4:42 PM