- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
02-10-2022 06:47 PM - edited 02-11-2022 07:11 AM
Any thoughts on why this is failing; this always returns Entries Found regardless if there are entities or not.
You can see in the screenshot above there are 0 results, no entries.
When I run this script, you'll see the screenshot below.
------Script------
##Check Sentinel for entities, if none, write a message to war room
external_id=demisto.incidents()[0]["CustomFields"]["externalid"]
entities = demisto.executeCommand("azure-sentinel-list-incident-entities", {"incident_id":external_id})
if not entities:
return_results("No entries")
elif "No entries." in entities:
return_results("No entries with period")
elif "No entries" in entities:
return_results("No entries without period")
elif len(entities)==0:
return_results("Length 0")
else:
return_results("Entries Found")
--------------------
If i print the object type, entities is a "list."
Any help would be greatly appreciated,
Thanks,
Boyd
02-11-2022 08:05 AM
Sorry, i don't have Sentinel integration up to test, but typically what is returned from demisto.executeCommand is a list and then you look into the "Contents" dictionary key inside the first value of that list to see what is returned. I would try:
entities = demisto.executeCommand("azure-sentinel-list-incident-entities", {"incident_id":external_id})[0]['Contents']
Also might want to add some print statements just for testing
02-11-2022 08:05 AM
Sorry, i don't have Sentinel integration up to test, but typically what is returned from demisto.executeCommand is a list and then you look into the "Contents" dictionary key inside the first value of that list to see what is returned. I would try:
entities = demisto.executeCommand("azure-sentinel-list-incident-entities", {"incident_id":external_id})[0]['Contents']
Also might want to add some print statements just for testing
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!