Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MyToDoTasksWidget] automation query bug fix #27856

Merged
merged 11 commits into from
Jul 4, 2023
3 changes: 0 additions & 3 deletions Packs/CommonWidgets/.pack-ignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[file:MyToDoTasksWidget.yml]
ignore=RM109

[known_words]
GetLargestInvestigations
GetLargestInputsAndOutputsInIncidents
Expand Down
7 changes: 7 additions & 0 deletions Packs/CommonWidgets/ReleaseNotes/1_2_25.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#### Scripts

##### MyToDoTasksWidget

- Fixed an issue that prevented the script from showing open tasks for users who had a significant number of closed tasks assigned to them.
- Updated the Docker image to: *demisto/python3:3.10.12.63474*.
17 changes: 11 additions & 6 deletions Packs/CommonWidgets/Scripts/MyToDoTasksWidget/MyToDoTasksWidget.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from dateparser import parse

import demistomock as demisto
from CommonServerPython import *
MAX_ENTRIES = 30


def get_open_to_do_tasks_of_current_user() -> List[Dict]:
body = {
"dataType": "todos",
"query": "assignee:\"{me}\"",
"widgetType": "table"
"query": "assignee:\"{me}\" and status:\"open\"",
"widgetType": "table",
"size": MAX_ENTRIES,
}
todo_tasks_query_res = demisto.internalHttpRequest(
'POST',
Expand Down Expand Up @@ -47,10 +49,13 @@ def get_open_to_do_tasks_of_current_user() -> List[Dict]:
return table


def main():
def main(): # pragma: no cover
try:
results = get_open_to_do_tasks_of_current_user()
table_name = f'My ToDo Tasks ({len(results)})'
if len(results) >= MAX_ENTRIES:
table_name = f'My ToDo Tasks (First {MAX_ENTRIES} Tasks)'
dorschw marked this conversation as resolved.
Show resolved Hide resolved
else:
table_name = f'My ToDo Tasks ({len(results)})'
readable_output = tableToMarkdown(table_name, results, headers=list(results[0].keys()) if results else None)
cmd_results = {
'Type': entryTypes['note'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags:
timeout: '0'
type: python
subtype: python3
dockerimage: demisto/python3:3.10.5.31928
dockerimage: demisto/python3:3.10.12.63474
fromversion: 6.1.0
tests:
- No test
26 changes: 26 additions & 0 deletions Packs/CommonWidgets/Scripts/MyToDoTasksWidget/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
A script that creates a table of all the ToDo tasks assigned to the current user.

## Script Data

---

| **Name** | **Description** |
| --- | --- |
| Script Type | python3 |
| Tags | widget |
| Cortex XSOAR Version | 6.1.0 |

## Inputs

---
There are no inputs for this script.

## Outputs

---
### Human Readable Output

>### My ToDo Tasks (1)
>|Task Name|Task Description|Task ID|SLA|Opened By|Incident ID|
>|---|---|---|---|---|---|---|
>| task | task description | 1@1 | 0001-01-01 00:00:00+0000 | user | 1 |
2 changes: 1 addition & 1 deletion Packs/CommonWidgets/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Widgets",
"description": "Frequently used widgets pack.",
"support": "xsoar",
"currentVersion": "1.2.24",
"currentVersion": "1.2.25",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down