Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
search.load.promise
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; }); }); } }; 0