jen
03/23/2023, 9:35 PMAnthony OConnor
03/23/2023, 9:39 PMAnthony OConnor
03/23/2023, 9:43 PMEdgar Valdés
03/23/2023, 9:45 PMAnthony OConnor
03/23/2023, 9:45 PMAnthony OConnor
03/23/2023, 9:48 PMAnthony OConnor
03/23/2023, 9:52 PMAnthony OConnor
03/23/2023, 9:56 PMjen
03/23/2023, 10:06 PMjen
03/23/2023, 10:06 PMjen
03/23/2023, 10:15 PMN/cache
might be the way to go, though this would be my first try with that module. If I can cache my 1000 list at the start that should work, I think.Anthony OConnor
03/23/2023, 10:18 PMtech_ph2019
03/24/2023, 12:35 AMjen
03/24/2023, 4:51 PMWatz
03/24/2023, 8:16 PMAnthony OConnor
03/24/2023, 9:51 PMWatz
03/24/2023, 9:51 PMWatz
03/24/2023, 9:51 PMAnthony OConnor
03/24/2023, 9:52 PMWatz
03/24/2023, 9:55 PMfetchEmployees()
is called in the beginning of the map-function and then we access the EMPLOYEE_LIST throughout the map-instance.
const EMPLOYEE_LIST = {
fetched: false,
employees : [],
}
const fetchEmployees = () => {
if(!EMPLOYEE_LIST.fetched) {
search.create({
type: search.Type.EMPLOYEE,
filters:[ ['isinactive', <http://search.Operator.IS|search.Operator.IS>, 'F'] ],
columns: [ EMPLOYEE.FIELDS.ENTITYID ],
}).run().each(result => {
const entityId = result.getValue(EMPLOYEE.FIELDS.ENTITYID) as string
EMPLOYEE_LIST.employees.push({
id: result.id,
[EMPLOYEE.FIELDS.ENTITYID]: entityId.toLowerCase(),
})
return true
})
EMPLOYEE_LIST.fetched = true
}
}
Anthony OConnor
03/24/2023, 9:58 PMEMPLOYEE_LIST
declaration is outside the map?
and when a new instance is created it will reset the global to empty?Watz
03/24/2023, 9:59 PMWatz
03/24/2023, 10:00 PMAnthony OConnor
03/24/2023, 10:01 PMWatz
03/24/2023, 10:01 PMAnthony OConnor
03/24/2023, 10:02 PMWatz
03/24/2023, 10:02 PM