How to capture retry data with preSavePage hook
Hi,
I have created preSavePage script to validate and show an error when one of the field is null. This script runs after data is extracted from snowflake query. the error doesn't show retry data.
Script:
function preSavePage(options) {
for (var i = 0; i < options.data.length; i++) {
try {
if (!options.data[i].SERVICENOW_SYS_ID.length >= 1) {
throw new Error('CustomerSYSID not found');
}
} catch (e) {
options.errors.push({
"code": "Customer SYS ID not found",
"message": "Customer ID Error with record: " + options.data[i].CONTRACT_LINE_ID,
"source": + options.data[i].CONTRACT_LINE_ID
});
}
}
return {
data: options.data,
errors: options.errors,
abort: false,
newErrorsAndRetryData: [options.data]
}
}
0
Comments
Krunal Patel you need to put your error and record data within the newErrorsAndRetryData field. Make sure to follow the instructions of the preSavePage script stub. See modified script and sample error output:
Thank you so much Tyler Lamparter. I wasn't aware we needed push retry data to newErrorsAndRetryData.
Please sign in to leave a comment.