PagerDutyAssignOnCallUser
By default assigns the first on-call user to an investigation (all incidents in the investigation will be owned by the on call user).
javascript · PagerDuty
Source
var res = executeCommand('PagerDuty-get-users-on-call-now', { escalation_policy_ids: args.escalation_policy_ids, schedule_ids: args.schedule_ids }); if (res[0].Type == entryTypes.error) { return res[0] } var usersOnCall = res[0].Contents.oncalls; var selectedUser = usersOnCall[0].user; if (selectedUser === null) { return 'error : could not find user from PagerDuty OnCall now!'; } res = executeCommand('getUserByEmail', {userEmail: selectedUser.email}); if (res[0].Type == entryTypes.error) { return res[0]; } var userId = res[0].Contents.id; setOwner(userId); return 'User ' + userId + ' was set as owner to incidents of this investigation';
README
Assigns the first on-call user to an investigation by default. All incidents in the investigation will be owned by the on call user.
Script Data
| Name | Description |
|---|---|
| Script Type | javascript |
| Tags | pagerduty, communication |
Dependencies
This script uses the following commands and scripts.
- PagerDuty-get-users-on-call-now
Inputs
| Argument Name | Description |
|---|---|
| escalation_policy_ids | The comma-separated escalation policy IDs from which choose the oncall user. |
| schedule_ids | The comma-separated schedule IDs from which to choose the oncall user. |
Outputs
There are no outputs for this script.