map reduce script to return saved search in get in...
# ask-stanley-ai
k
map reduce script to return saved search in get input stage from parameter
c
AI generated answer (using internal Slack threads):
In a Map/Reduce script in SuiteScript, the
getInputData
function is used to gather the data that will be processed by the script. If you want to return a saved search in the
getInputData
stage from a parameter, you can do so by using the
runtime.getParameter
method to get the parameter value, and then return an object that specifies the type as "search" and the id as the parameter value. Here is an example:
Copy code
javascript
function getInputData(context) {
    return {
        type: "search",
        id: runtime.getParameter('my_search_param')
    };
}
In this example, 'my_search_param' is the parameter that holds the ID of the saved search you want to return. This will return a reference to the saved search, which will then be used as the input data for the Map/Reduce script. If you need to load two different saved searches in the
getInputData
function, you would need to run each search separately, combine the results into an array, and then return that array. The array will then be passed to the
map
stage of the script. Alternatively, if the record types are related, you could combine them into a single saved search, or use SuiteQL to combine the searches into one. ****** 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.835083067
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832702696
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828735411
Please provide your feedback on this answer.