I have a map/reduce script that I can pass documen...
# suitescript
d
I have a map/reduce script that I can pass document numbers to and I want it to set list/record fields to associate the corresponding transaction for that document number. How do I set the field without having to run a search to find an internal id when I already have a doc id? I got the code below to work in a schedule workflow as a workflow action script, but It doesn't work in a map/reduce.
Copy code
var soString     = 'Sales Order #' + docId;
newRec.setText({
     fieldId: 'custrecord_salord',
     text: soString
 });
s
If at all possible, try to rework the process to send the internal ids to the Map/Reduce script instead of the document number (tranid), since you can then use record.submitFields with the internal id. Otherwise, in the getInputData, return a search or query to get the internal ids of the transactions, from the given document numbers.