{"type":"error.SuiteScriptError","name":"SSS_USAGE...
# ask-stanley-ai
n
{"type":"error.SuiteScriptError","name":"SSS_USAGE_LIMIT_EXCEEDED","message":"Script Execution Usage Limit Exceeded","id":"","stack":["Error\n at searchTransactions (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js6117)\n at createForm (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js47838)\n at handleScriptCall (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js21420)\n at Object.onRequest (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js17813)"],"cause":{"type":"internal error","code":"SSS_USAGE_LIMIT_EXCEEDED","details":"Script Execution Usage Limit Exceeded","userEvent":null,"stackTrace":["Error\n at searchTransactions (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js6117)\n at createForm (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js47838)\n at handleScriptCall (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js21420)\n at Object.onRequest (/SuiteScripts/_Suitelet 2x Item Purchasing Report AlJomaih.js17813)"],"notifyOff":false},"notifyOff":false,"userFacing":true} for this function searchTransactions(itemid) { let transactionSearch = search.create({ type: search.Type.TRANSACTION, filters: [{"name":"type","operator":"anyof","values":["CashRfnd","CashSale","CustCred","CustInvc"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"mainline","operator":"is","values":["F"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"type","join":"item","operator":"anyof","values":["InvtPart"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"taxline","operator":"is","values":["F"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"shipping","operator":"is","values":["F"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"cogs","operator":"is","values":["F"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"status","operator":"noneof","values":["CashSale:A","CustRfnd:R","CustRfnd:V","CustInvc:D","CustInvc:E","CustInvc:V"],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}, {"name":"item","operator":"anyof","values":[""+itemid],"isor":false,"isnot":false,"leftparens":0,"rightparens":0}] , columns: [{"name":"item","summary":"GROUP","label":"Item","type":"select","sortdir":"NONE"}, {"name":"custitem_atc_item_brand","join":"item","summary":"GROUP","label":"ATC Item Brand","type":"select","sortdir":"NONE"}, {"name":"quantity","summary":"SUM","label":"Quantity","type":"float","sortdir":"NONE"}, {"name":"quantity","summary":"AVG","label":"Average Sales","type":"float","function":"round","sortdir":"NONE"}] }); var results = transactionSearch.run(); var searchResults = []; results.each(function(result) { searchResults.push({ item: result.getValue({ name: 'item', summary: search.Summary.GROUP }), brand: result.getValue({ name: 'custitem_atc_item_brand', join: 'item', summary: search.Summary.GROUP }), totalQuantity: result.getValue({ name: 'quantity', summary: search.Summary.SUM }), averageSales: result.getValue({ name: 'quantity', summary: search.Summary.AVG }) }); return true; }); log.debug('Search Results', searchResults); return { searchResults: searchResults }; } var resultIndex = 0; var resultStep = 1000; var resultSet; var csvData = []; do { resultSet = mySearch.run().getRange({ start: resultIndex, end: resultIndex + resultStep }); for (var i = 0; i < resultSet.length; i++) { // for (var i = 0; i < 1; i++) { var result = resultSet[i]; var currItemId; for (var j = 0; j < searchColumns.length; j++) { var columnName = 'custpage_item_purchasing_' + searchColumns[j].name; log.debug({ title: "columnName ", details: columnName }); var columnValue = result.getValue(searchColumns[j]); log.debug({ title: "columnValue ", details: columnValue }); log.debug({ title: "columnValue == undefined", details: columnValue == undefined }); log.debug({ title: "columnValue == empty string with space ", details: columnValue == " " }); log.debug({ title: "columnValue == ", details: columnValue == "" }); if(columnValue) { if(columnName === 'custpage_item_purchasing_custitem_atc_item_brand') { var text = result.getText(searchColumns[j]); sublist.setSublistValue({ id: columnName, line: resultIndex + i, value: text }); } else { if(columnName === 'custpage_item_purchasing_internalid') { currItemId = result.getValue(searchColumns[j]); } sublist.setSublistValue({ id: columnName, line: resultIndex + i, value: columnValue }); } } else { sublist.setSublistValue({ id: columnName, line: resultIndex + i, value: " " }); } } log.debug({ title: "currItemId ", details: currItemId }); // currItemId = getItemId(currItem); var currItemSS = searchTransactions(currItemId); log.debug({ title: "currItemSS ", details: currItemSS.searchResults }); } resultIndex += resultStep; } while (resultSet.length === resultStep);
c
AI generated answer (using internal Slack threads):
The conversations are about SuiteScript and handling search results in NetSuite. In the first conversation, a user is asking why the same result shows up on two different lines in their search results. Another user suggests that it might be due to a join that returns several possible values. In the second conversation, a user is encountering an error
SSS_SEARCH_RESULT_LIMIT_EXCEEDED
when trying to pull 1000 lines each time from a search result set. The user is advised to use a paged search instead of
getRange
to avoid this error. The user is also advised to debug their code to understand the issue better. In the third conversation, a user is getting an error
Cannot read property 'getValue' of undefined
when trying to get a value from a search result. Another user points out that it might be a copy-paste error and the user doesn't need to use
[i]
anymore because
result
is no longer an array. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.871669173
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.863536
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86021024
Please provide your feedback on this answer.