Use DT format inside an automation.

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.

Use DT format inside an automation.

L4 Transporter

Hello,

We are working on an automation which calls many different lists of nested dicts. Example:

upField:

0:

field1:value1

field2: value2

1:

field1:value3

field2: value4

 

In a playbook it will be easy to call only field1 using this expression: ${upField.field1} . It will create an array with these values:

[value1, value3]

However, if we want to get these values in an automation, a loop "for" has to be created to go over each dict of the list. Turning into a tedious, heavy and not flexible automation.

 

To avoid this, we tried unsuccessfully to use the commands "demisto.executeCommand("jmespath",{})" and "demisto.executeCommand("demisto.dt()",{})".

 

How can we achieve a simple command similar to "${}" in an automation?

 

1 accepted solution

Accepted Solutions

L4 Transporter

Hi @Josep ,


Can you please try the below dt statement?

field1_values = demisto.dt(upField, 'field1')

I hope it solves your problem!

View solution in original post

2 REPLIES 2

L4 Transporter

Hi @Josep ,


Can you please try the below dt statement?

field1_values = demisto.dt(upField, 'field1')

I hope it solves your problem!

You are the best @gyldz, it worked.

The nested dict was deeper, I show you the full commnand to solve it:

 

Data = demisto.get(demisto.context(),"Data")
field1_values = demisto.dt(Data, 'upField.midField.downField')

 

  • 1 accepted solution
  • 879 Views
  • 2 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!