Why do I get an error in MapReduce execution when ...
# ask-stanley-ai
a
Why do I get an error in MapReduce execution when I'm returning a Query object from my getInputData function, even though the help documentation below states that Query objects are among the things that such a function should return? getInputData(inputContext) Description Marks the beginning of the script’s execution. The purpose of the input stage is to generate the input data. Executes when the getInputData entry point is triggered. This entry point is required. For information about the context object provided to this entry point, see inputContext. Note When
getInputData()
returns a data structure with a non-string value, before the value is stored, it is converted to a JSON string with
JSON.stringify()
. Returns Array | Object | File | Query | Dataset | Search | object reference (file, suiteql, query, search)
c
AI generated answer (using internal Slack threads):
Based on the conversations, the error in MapReduce execution when returning a Query object from the
getInputData
function might be due to the way you are handling the Query object. The
getInputData
function should return an object that can be transformed into a list of key/value pairs. If you are using a search, it is recommended to return either a search.Search object or an object reference to a saved search, rather than executing a search within the
getInputData
function and returning the results. This is because there is a greater risk that the search will time out if executed within the function. For SuiteQL, you can return an object like this:
Copy code
return {
    type: 'suiteql',
    query: "SELECT ... FROM ... "
};
This will allow NetSuite to execute the SuiteQL query. For a saved
query.Query
object (analytics workbook), you can return an object like this:
Copy code
return {
    type: 'query',
    id: 'custworkbook237'
}
This will allow NetSuite to execute the saved query. Remember, the time limit available to the search is more generous than it would be for a search executed within the function. ****** 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.863344669
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859990656
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.852231562
Please provide your feedback on this answer.