Hi All,
I'm looking for validation that I'm using the search.load.promise correctly. Any tips, suggestions or criticism is welcome!
exports.Departments = []; exports.pageInit = function (context) { if (context.mode.toString() !== 'edit') { search.load.promise({ id: 'customsearch_dh_get_account_restrictions' }).then(function (searchObj) { return searchObj.run(); }).then(function (results) { results.each.promise(function (result) { var departmentId = parseInt(result.getValue({ join: 'CUSTRECORD_ALLOWED_DEPARTMENTS', name: 'internalid' })); if (!isNaN(departmentId)) { if (!exports.Departments[departmentId]) { exports.Departments[departmentId] = { AccountIds: [] }; } exports.Departments[departmentId].AccountIds.push(parseInt(result.id, 10)); } return true; }); }); } };