Hi there! I'm running a Map Reduce script to creat...
# suitescript
n
Hi there! I'm running a Map Reduce script to create Work Orders and need to do additional logic on the last record that is to be created. Is there a way to find that out? Thanks!
b
easiest would probably be doing the logic in the summarize entry point
e
Map Reduce scripts can be creating multiple transactions at the same time so a little difficult to define the “last record”. Within the summary function, you could look at the context.output.
s
Probably best to do a simple search or query in the summarize step to try and identify the last work order created (by created date, perhaps) then perform the logic you need to on that record. Alternatively, if you really don't need the parallel execution and the amount of work orders created wouldn't exceed the governance for a scheduled script, this might be a good use case for a scheduled script.
n
Ohh that's a good idea to pull it in the Summary step! Yeah I was thinking of Scheduled Script but since the information is coming from a CSV, I didn't want to have to get into the limit for it