Custom Widget Xsoar

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Widget Xsoar

L2 Linker

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

1 accepted solution

Accepted Solutions

L4 Transporter

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.




View solution in original post

1 REPLY 1

L4 Transporter

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.




  • 1 accepted solution
  • 1220 Views
  • 1 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!