Skip to content

Instantly share code, notes, and snippets.

@rs77
Created November 13, 2023 21:35
Show Gist options
  • Save rs77/d28ea4e0fe197c1cf611f9b19071e11e to your computer and use it in GitHub Desktop.
Save rs77/d28ea4e0fe197c1cf611f9b19071e11e to your computer and use it in GitHub Desktop.
Suitescript summarize function for a Map/Reduce script
const summarize = (summaryContext) => {
log.debug({title: 'SUMMARY', details: summaryContext});
if (summaryContext.inputSummary.error) {
log.error({title: 'INPUT ERROR', details: summaryContext.inputSummary.error});
}
summaryContext.mapSummary.errors.iterator().each(
(key, error) => {
log.error({title: `MAP ERROR: ${key}`, details: error});
return true;
}
);
summaryContext.reduceSummary.errors.iterator().each(
(key, error) => {
log.error({title: `REDUCE ERROR: ${key}`, details: error});
return true;
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment