IncOwnerToBonuslyUser
This script gets the email address of the incident owner and then returns the incident owner username in Bonusly.
- Type
- python
- Pack
- Bonusly
Source
import demistomock as demisto
from CommonServerPython import *
"""
Pass in JSON key value lookup then fetches the incident owner and finds the bonusly user
"""
json_lookup = demisto.args().get("json")
if isinstance(json_lookup, str):
json_lookup = json.loads(json_lookup)
def inc_owner_bonusly_user():
owner_username = demisto.args().get("owner")
if owner_username:
try:
owner_info = demisto.executeCommand("getUserByUsername", {"username": owner_username})[0]
owner_email = owner_info.get("EntryContext").get("UserByUsername").get("email")
bonusly_user = json_lookup[owner_email]
readable_output = "# Incident Owners Email \n" + owner_email + "\n # Bonusly User " + bonusly_user
outputs = {"IncOwnerEmail": owner_email, "BonuslyUser": bonusly_user}
return return_outputs(readable_output, outputs, owner_email)
except Exception as ex:
return_error(f"Error: {ex}")
else:
return_error("Error: Email for owner of incident was not found") # noqa: RET503
if __name__ in ("__main__", "__builtin__", "builtins"):
inc_owner_bonusly_user()
README
This script gets the email address of the incident owner and then returns the incident owner username in Bonusly.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | Bonusly, Utilities |
| Cortex XSOAR Version | 5.0.0 |
Used In
This script is used in the following playbooks and scripts.
- Bonusly - AutoGratitude
Inputs
| Argument Name | Description |
|---|---|
| json | Enter JSON STRING like {‘email@company’:’@bonuslyuser’} |
| owner | The username of the Cortex XSOAR incident owner. This will look up the incident owner’s email address. |
Outputs
| Path | Description | Type |
|---|---|---|
| IncOwnerEmail | Email address of the incident owner. | Unknown |
| BonuslyUser | Usernname in Bonusly of the incident owner. | Unknown |