- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Enhanced Security Measures in Place: To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.
12-14-2023 01:01 AM
Hi, I am trying to create a custom widget that calculate follwing (Total Incident+ Total Command Execution) with date paramters adjusted by widget. I tried to implement this with JSON method and Automation Script but unable to get the solution. Can you suggest some solution and how this will be acheieved using automation script.
Second question is it possible that we can alter the output of widget thorugh JSON widget method(like if we get total incidents then we perform some calculations on it) and then return the output Thank you in advance #xsoar #automation @members
12-20-2023 12:45 AM
Hi @Syedhkt ,
If you want to get only the numbers, you don't need to use a script. Dashboard data sources are capable of it. I am sending an example. You can play with data using an automation script for the second question. For example, If you want to play with the incident data, you can use the below commands to get the incidents and then do some calculations according to your needs.
res = demisto.executeCommand("GetIncidentsByQuery", {"fromDate": "5 days ago", "query":"-status:closed"})[0]['Contents']
incidents = json.loads(res)
As a reference, please see the attachment for a widget automation script which calculates the task duration using /workers/status API endpoint.
12-20-2023 12:45 AM
Hi @Syedhkt ,
If you want to get only the numbers, you don't need to use a script. Dashboard data sources are capable of it. I am sending an example. You can play with data using an automation script for the second question. For example, If you want to play with the incident data, you can use the below commands to get the incidents and then do some calculations according to your needs.
res = demisto.executeCommand("GetIncidentsByQuery", {"fromDate": "5 days ago", "query":"-status:closed"})[0]['Contents']
incidents = json.loads(res)
As a reference, please see the attachment for a widget automation script which calculates the task duration using /workers/status API endpoint.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!