I am trying to transfer parameter from a User Even...
# suitescript
k
I am trying to transfer parameter from a User Event Script to Map / Reduce Script. Any documentation on links on how to properly do this?
b
k
Copy code
let myTask = task.create({
    taskType: task.TaskType.MAP_REDUCE,
    scriptId: 'customscriptlf_royalty_map_reduce',
    deploymentId: 'customdeploy_lf_royalty_map',
    params: {
        'cutscript_school_id_param' : schoolName,
        'cutscript_school_std_roy_perc': standardRoyalty,
        'cutscript_lf_school_hdwr_roy_perc': headwearRoyalty,
        'cutscript_lf_school_spec_roy_perc': specialRoyalty
    }
})
@battk I succesfully created a task create but I cant get the values in the map reduce file to display
c
@Kevin Baxter every parameter name you pasted there starts with
cutscript_...
which is missing an
s
and should be
custscript_...
b
usually you get the id from copy and pasting from the script parameter you create
so assuming you just arent bad at copy and pasting, make sure you actually create the script parameter
k
but how to I access those values on the map reduce script i am running
do I use runtime.getCurrentScript.getParameter()
r
Try it once and you will know.
s
i did recently the same for a scheduled script, but the ligic should be the same.
Copy code
// on the user event script (or any script you want to call the scheduled script)
const taskObj = task.create({
  taskType: task.TaskType.SCHEDULED_SCRIPT,
  scriptId: 'scriptId',
  deploymentId: 'deploymentId',
  params: {
    custscript_param_id: '1234'
  }
})
taskObj.submit()

// on the scheduled script
const paramId = runtime.getCurrentScript().getParameter({ name: 'custscript_param_id' })