Kris Wood
05/31/2024, 9:10 PMKris Wood
05/31/2024, 9:13 PMClay Roper
05/31/2024, 9:16 PMKris Wood
05/31/2024, 9:16 PMKris Wood
05/31/2024, 9:16 PMKris Wood
05/31/2024, 9:17 PMKris Wood
05/31/2024, 9:19 PMClay Roper
05/31/2024, 9:22 PMClay Roper
05/31/2024, 9:23 PMbattk
05/31/2024, 9:29 PMbattk
05/31/2024, 9:29 PMbattk
05/31/2024, 9:29 PMKris Wood
05/31/2024, 9:29 PMKris Wood
05/31/2024, 9:31 PMrustyshackles
05/31/2024, 9:35 PMKris Wood
05/31/2024, 9:36 PMbattk
05/31/2024, 9:37 PMKris Wood
05/31/2024, 9:37 PMbattk
05/31/2024, 9:37 PMKris Wood
05/31/2024, 9:41 PMfunction getInputData() {
try {
// Get the last run time from the script parameter
let lastRunTime = runtime.getCurrentScript().getParameter({
name: 'custscript_last_run_time'
});
// If null, set to yesterday at midnight
if (!lastRunTime) {
lastRunTime = new Date();
lastRunTime.setHours(0, 0, 0, 0);
lastRunTime.setDate(lastRunTime.getDate() - 1);
} else {
lastRunTime = new Date(lastRunTime);
}
// Load the script deployment record to set the last run time
var scriptDeployment = record.load({
type: record.Type.SCRIPT_DEPLOYMENT,
id: runtime.getCurrentScript().deploymentId
});
scriptDeployment.setValue({
fieldId: 'custscript_last_run_time',
value: new Date()
});
// Save the script deployment record
scriptDeployment.save();
// Search messages created after the last run time, the only column we need is internalid
return search.create({
type: 'message',
filters: [
['created', 'after', lastRunTime]
],
columns: ['internalid']
});
} catch (e) {
log.error({
title: 'Error in getInputData',
details: e.toString()
});
throw e;
}
}
battk
05/31/2024, 9:48 PMruntime.getCurrentScript().deploymentId
Kris Wood
05/31/2024, 10:12 PMbattk
05/31/2024, 10:13 PMKris Wood
05/31/2024, 10:13 PMbattk
05/31/2024, 10:14 PMKris Wood
05/31/2024, 10:14 PMKris Wood
05/31/2024, 10:16 PMKris Wood
05/31/2024, 10:16 PMKris Wood
05/31/2024, 10:16 PMbattk
05/31/2024, 10:20 PMKris Wood
05/31/2024, 10:20 PMKris Wood
05/31/2024, 11:00 PM