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.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
Activity search Error
Hi Guys,
I have a Scheduled SuiteScript that runs fine and I am now trying to add a function that returns the number of events attached to the lead, and I am getting the following debug + Error.
I have run the search in the UI and it returns 1 record. Any ideas?
function GetNumberofEvents(customerName) { // Build Criteria for Search var filters = new Array(); filters[0] = new nlobjSearchFilter('type', null, 'anyof', 'event'); filters[1] = new nlobjSearchFilter('company', null, 'anyof', customerName); // Return results from the Search var results = new Array(); results[0] = new nlobjSearchColumn('title'); nlapiLogExecution('DEBUG', 'Before act Search', 'customerID:' + customerName); // Execute the search var numberOfEvents = nlapiSearchRecord('activity', null, filters, results); if(numberOfEvents == null) { nlapiLogExecution('DEBUG', 'after act Search', 'number of events ' + 0); return 0; } else { nlapiLogExecution('DEBUG', 'after act Search', 'number of events ' + numberOfEvents); return parseInt(numberOfEvents); } } 0