title: How to pass a value from getInputData() to map() function in map reduce suitescript?
body: <p>I have made a suitelet that is running a map-reduce script and passing a parameter which is a date. Now what is required is to include that date object (coming from suitelet) in the <code>map()</code> function. So that the record that will be created in <code>map()</code> can have that date as <code>trandate</code>.</p>
  
  <pre><code> define(['N/record', 'N/search', 'N/runtime'], function (record, search, runtime) {
    function getInputData() {
      try {
        var slfilter = runtime.getCurrentScript().getParameter({ name: 'custscript_searchfilter_date' });
        slfilter.replace(/\\/g, "");
        var dateSL = JSON.parse(slfilter);
        log.debug('dateSL parsed', dateSL)
        var date = dateSL['date'];
        log.debug('date', date);
  
        var savedSearch = search.load({ id: 'customsearch_wip_correction' });
  
        var results = getResults(savedSearch.run())
        log.debug('results:', results)      
  
        return results;
      }
      catch (e) {
        log.error("GetInputData ", e);
      }
    }
  
    function map(context) {
  
      try {
      // date is required here 
      var data = JSON.parse(context.value);
      log.debug('map:' + context.key, context.value)
  
      var amount = data.values['SUM(amount)'];
      log.debug('amount', amount)
  
      var location = data.values['GROUP(location)'][0].value;
      log.debug('location', location)
  }
  catch (e) {
    log.error("map", e)
  }
  
  
   }
  </code></pre>