reduceContext.executionNo
Property Description |
Indicates whether the current invocation of the reduce(reduceContext) function is the first, second, third, or fourth for the current key and its values. For an overview of events that can cause a restart, see System Response After a Map/Reduce Interruption. When the reduce function restarts for a key, any data it wrote last time is deleted. Some logic might have run before it was interrupted, so you might want to use reduceContext.executionNo to help avoid duplicate processing. For examples of how to write a robust map/reduce script, see Adding Logic to Handle Map/Reduce Restarts. Related properties include reduceContext.isRestarted and reduceContext.errors. |
Type |
number |
Since |
2018.1 |
Syntax
The following code snippet shows the syntax for this member. It's not a functional example. For a complete script example, see SuiteScript 2.x Map/Reduce Script Code Samples.
// Add additional code
...
if (context.executionNo === 1){
// Permit full processing of the key-value pair.
}
else if (context.executionNo === 2){
// Take steps to check whether any processing was previously completed.
}
else {
// Take other steps that might be necessary in the case of more than
// one previous attempt.
}
...
// Add additional code