ShowScheduledEntries
Show all scheduled entries for specific incident.
- Type
- javascript
- Pack
- CommonScripts
Source
var incidentId = args.incidentId;
var entries = executeCommand("getEntries", { id: incidentId });
var header = 'Scheduled entries for current incident:';
if (incidentId) {
header = 'Scheduled entries for incident #' + incidentId + ':';
}
var warRoomUrl = demistoUrls().warRoom;
var md = '### ' + header + '\n';
md += 'Entry ID|Command\n';
md += '-|-\n';
var scheduledEntries = [];
entries.forEach(function (entry) {
if (entry.Metadata !== null && entry.Metadata.Recurrent && entry.Metadata.Schedule.Scheduled) {
md += '['+ entry.ID + '](' + warRoomUrl + '/' + entry.ID + ')' + '|' + entry.Contents + '\n';
scheduledEntries.push({
id: entry.ID,
brand: entry.Brand,
type: entry.Type,
contents: entry.Contents,
contentsFormat: entry.ContentsFormat,
note: entry.Note,
evidence: entry.Evidence,
tags: entry.Tags,
investigationID: entry.Metadata.InvestigationID,
schedule: entry.Metadata.Schedule
});
} else {
logDebug("unexpected entry structure:");
logDebug(entry);
}
});
if (!scheduledEntries || scheduledEntries.length === 0) {
if (incidentId) {
return 'There are no scheduled entries for incident #' + incidentId + '.';
}
return 'There are no scheduled entries for current incident.';
}
entryResult = {
Type: entryTypes.note,
Contents: scheduledEntries,
ContentsFormat: formats.json,
ReadableContentsFormat: formats.markdown,
HumanReadable: md,
EntryContext: {
ScheduledEntries: scheduledEntries
}
};
return entryResult;
README
Shows all scheduled entries for the specific incident.
Script Data
| Name |
Description |
| Script Type |
javascript |
| Tags |
Utility |
Inputs
| Argument Name |
Description |
| incidentId |
The incident ID to get the tasks from. |
Outputs
| Path |
Description |
Type |
| ScheduledEntries |
The entire scheduled entry object. |
Unknown |
| ScheduledEntries.id |
The entry ID. |
string |
| ScheduledEntries.contents |
The entry contents (the scheduled command). |
string |
| ScheduledEntries.type |
The entry type. |
number |
| ScheduledEntries.investigationID |
The entry’s investigation ID. |
string |
| ScheduledEntries.schedule.startDate |
The entry’s scheduled start date. |
Unknown |
| ScheduledEntries.schedule.EndingType |
The entry’s scheduled ending type. Can be, “by” or “after”. |
Unknown |
| ScheduledEntries.schedule.Times |
The entry’s scheduled time until end. This applies when the ending type is “by”. |
number |
| ScheduledEntries.schedule.EndingDate |
The entry’s scheduled end time. This applies when the ending type is “after”. |
Unknown |
| ScheduledEntries.schedule.cron |
The entry schedule CRON. |
string |
| ScheduledEntries.schedule.HumanCron |
The entry schedule settings. |
Unknown |