Are there any restrictions on creating new records...
# suitescript
c
Are there any restrictions on creating new records during the map phase of map/reduce? I have the following code. In my execution logs, I see each of the logs except for the final one — ‘Created task’ which implies it is failing on task.save()
Copy code
const map = (mapContext) => {
        rec = JSON.parse(mapContext.value)
        if (rec.externalid){

                log.debug("Creating new record", rec.externalid)
                let task = record.create({type:record.Type.PROJECT_TASK})
                log.debug("Before set values")
                setValues(task,rec)
                log.debug("Before task save")
                let new_task_id = task.save({enableSourcing:true, ignoreMandatoryFields: false});
                log.debug("Created task", new_task_id)
        }
}
However, I don’t see any errors in the execution log of the deployement… the final debug line is simple missing:
b
c
Thanks, I actually got it working by doing a try catch and logging the caught error
b
eventually you will have to implement the summarize logging, not all errors that are thrown can be caught
c
Thanks I will look into it