mapContext.executionNo
Property Description |
Indicates whether the current invocation of the map(mapContext) function is the first or a subsequent invocation for the current key-value pair. For an overview of events that can cause a restart, see System Response After a Map/Reduce Interruption. When the map function restarts for a key-value pair, any data it wrote last time is deleted. Some logic might have run before it was interrupted, so you might want to use mapContext.executionNo to add logic that avoids duplicate processing. For examples of how to write a robust map/reduce script, see Adding Logic to Handle Map/Reduce Restarts. Related properties include mapContext.isRestarted and mapContext.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