conditional check if Azure Entities command returns with "No entries."

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

conditional check if Azure Entities command returns with "No entries."

L2 Linker

Any thoughts on why this is failing; this always returns Entries Found regardless if there are entities or not.

 

jboyd98_0-1644547225732.png

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")

--------------------

jboyd98_2-1644547571215.png

 

If i print the object type, entities is a "list."

Any help would be greatly appreciated,

 

Thanks,

 

Boyd

 

1 accepted solution

Accepted Solutions

L2 Linker

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

View solution in original post

1 REPLY 1

L2 Linker

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

  • 1 accepted solution
  • 1693 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!