AssignAnalystToIncidentOOO
Assigns analysts who are not out of the office to the shift handover incident. Use the ManageOOOusers automation to add or remove analysts from the out-of-office list. This automation runs using the default Limited User role, unless you explicitly change the permissions. For more information, see the section about permissions here: For Cortex XSOAR 6 use the link https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations and for Cortex XSOAR 8 Cloud use the link https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script.
python · Shift Management
Details
| ID | AssignAnalystToIncidentOOO |
|---|---|
| Language | python |
| From Version | 5.5.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Tags | Shift Management ooo |
README
Assigns analysts who are not out of the office to the shift handover incident. Use the ManageOOOusers automation to add or remove analysts from the out-of-office list.
Permissions
This automation runs using the default Limited User role, unless you explicitly change the permissions.
For more information, see the section about permissions here: For Cortex XSOAR 6, see the https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations for Cortex XSOAR 8 Cloud, see the https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script for Cortex XSOAR 8 On-prem, see the https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8.7/Cortex-XSOAR-On-prem-Documentation/Create-a-script.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | Shift Management, ooo |
| Cortex XSOAR Version | 5.5.0 |
Used In
This script is used in the following playbooks and scripts.
Shift handover
Inputs
| Argument Name | Description |
|---|---|
| roles | The list of roles from which to assign analysts to the shift handover incident. Can be an array or a comma-separated list. Leave empty to assign all analysts. |
| oncall | Whether to randomly assign analysts who are on call for the shift handover. Possible values: “true” and “false”. Requires Cortex XSOAR v5.5 or later. |
| listname | The name of the out-of-office list. Default is “OOO List”. |
| assignAll | Whether to assign all on-call analysts to the shift handover incident. Set to “true” to assign all on-call analysts. |
Outputs
There are no outputs for this script.
import json import pytest def util_load_json(path): with open(path, encoding="utf-8") as f: return json.loads(f.read()) user_data = util_load_json("test_data/user_data.json") away_user_data = util_load_json("test_data/away_user_data.json") ooo_user_data = util_load_json("test_data/ooo_user_data.json") def execute_command_mock(command, args): if command == "getUsers": return [{"Type": 6, "Contents": user_data}] if command == "GetAwayUsers": return [{"Type": 6, "EntryContext": {"AwayUsers": away_user_data}}] if command == "GetUsersOOO": return [{"Type": 6, "EntryContext": {"ShiftManagment.OOOUsers": ooo_user_data}}] if command == "setOwner": assert "admin" in args["owner"] return [{"Type": 6}] if command == "AssignAnalystToIncident": assert "admin" in args["username"] return [{"Type": 6}] raise Exception(f"Unexpected command: {command}") @pytest.mark.parametrize("args", [({"assignAll": False}), ({"assignAll": True})]) def test_script_flow(mocker, args): """ Given: - Cortex XSOAR args. When: - Calling AssignAnalystToIncidentOOO. Then: - Ensure expected behaviour. Behaviour of expected given args for commands are checked via the `execute_command_mock` function. """ import demistomock as demisto from AssignAnalystToIncidentOOO import main mocker.patch.object(demisto, "executeCommand", side_effect=execute_command_mock) mocker.patch.object(demisto, "args", return_value=args) main()