- 04 Aug 2024
- 9 Minutes to read
- Print
- DarkLight
- PDF
Using the Dynamic Value Statement Wizard
- Updated on 04 Aug 2024
- 9 Minutes to read
- Print
- DarkLight
- PDF
You can create Dynamic Value Statements using the following methods:
- The Wizard
- The Autocomplete feature and Syntax Helper.
This page explains how to create Dynamic Value Statements using the Wizard.
Before configuring a Dynamic Value Statement, do the following:
- In the Enforcement Set configuration, in the Module dropdown, select the assets on which to run the query.
- Fill in default values for the action fields that are below the statement. These will be the fallback values for the Dynamic Value Statement.
After completing the Dynamic Value Statement and saving the Enforcement Set, you can click Simulate to debug the statement.
Creating a Dynamic Value Statement Using the Wizard
Adding an All Statement
This section describes how to construct an All statement using the Wizard.
You can use the Wizard to construct a simple set-value statement to set the value of an action field to the value of an adapter field. You can optionally enhance the Dynamic Value statement as follows:
- Configure an additional action field, using Also.
- Add alternative configurations to any of the action fields, using OR. You can define multiple adapter fields as possible sources for the value of the action field. The adapter fields are checked for values in the order that they are defined (top to bottom). When a value is found in a field, it is assigned to the action field, and the remaining adapter fields are ignored and not processed. If none of the fields in the OR clauses have a value, the default value (fallback) defined in the action field is used.
Learn more about All Statement Syntax.
To construct an All statement
- Toggle on Configure Dynamic Values and then click Wizard. The Dynamic Value Statement Wizard for creating an All statement opens.
- From the Select form field dropdown, select the action field to populate.
- In the Adapter and Select Adapter Field dropdowns, select the adapter and its field whose value is to populate the action field (selected in the previous step). Learn more about how to select an adapter and how to select an adapter field.
The module (asset type) must be set in order to select an adapter and adapter field. If you did not select a module, the following tooltip is displayed when you attempt to select an adapter field: Select entity type in enforcement set query to get relevant fields.
- Click + Add Alternative to add an OR clause to the statement and repeat the previous step. The screen below shows an All statement with several OR clauses.
- Repeat the previous step for each OR clause that you want to add to the statement.
- Click + Also to add an action field to the statement, and proceed according to the previous three steps.
- Repeat the previous step for each action field that you want to include in the statement.
You can click Syntax to view the syntax of the statement created by the Wizard. Learn more about converting from WIzard to Syntax. The following screen shows the results of hovering over a component in the statement.
After saving the Enforcement Set, you can click Simulate from either above the Wizard or Syntax statement to debug the statement.
Adding a Switch/Case Statement
This section describes how to construct a Switch/Case statement using the Wizard.
You can use the Wizard to construct a simple set-value statement to define a condition that if met, sets the value of an action field to the value of an adapter field. You can optionally enhance the Dynamic Value statement as follows:
- Configure an additional action field to set if the condition is met, using Also.
- Add an alternative condition with its own set of action fields to set if the condition is met, using ELSE IF. The conditions are checked in the order that they are defined (top to bottom). When a condition is met, the action fields under that condition are assigned values, and the remaining conditions are ignored and not processed. If none of the conditions are met, the default value (fallback) defined in the action field is used.
Learn more about Switch/Case Statement Syntax.
To construct a Switch/Case statement
- Toggle on Configure Dynamic Values, click Wizard, and then click Switch to value by condition. The Dynamic Value Statement Wizard for creating a Switch/Case statement opens.
- Configure the Switch part of the statement:
- From the Adapter and Select Adapter Field dropdowns, select the adapter and adapter field. Learn more about how to select an adapter and how to select an adapter field.
- From the Select operator dropdown, select the operator to use on the adapter field value, and in Write, type the value to compare to the field value using the operator.
The module (asset type) must be set in order to select an adapter and adapter field. If you did not select a module, the following tooltip is displayed when you attempt to select an adapter field: Select entity type in enforcement set query to get relevant fields.
Configure the Case part of the statement:
- From the Select form field dropdown, select the action field that you want to populate.
- Select whether to populate the action field with an adapter field or custom input.
- Adapter field - For this choice, from the Adapter and Select Adapter Field dropdowns, select the adapter and adapter field.
- Custom Input - For this choice, type a value in the Value (Write) box.
Click + Also to populate an additional action field in the Case part of the statement. Proceed as in the previous step.
Repeat the previous step for each action field that you want to populate for this IF condition.
Click Add Condition to add an ELSE IF clause to the statement and repeat the previous three steps.
- The adapter and adapter field cannot be changed in the ELSE IF clauses.
- You can click Remove Condition to remove any condition except the first. This button appears from the second condition onward.
- Repeat the previous step for each ELSE IF clause to add to the statement.
You can click Syntax to view the syntax of the statement created by the Wizard. Learn more about converting from WIzard to Syntax.
After saving the Enforcement Set, you can click Simulate from either above the Wizard or Syntax statement to debug the statement. The following screen shows the results of hovering over a component in the statement.
Selecting an Adapter
The Adapter dropdown contains a list of all adapters that fetched data for assets. The adapter that you select from this dropdown controls the list of fields displayed in the Adapter Field dropdown.
The first entry and default selection in this dropdown is Aggregated represented by the icon. All Aggregated fields contain the aggregated (i.e., collated) values from all of the data that was fetched for all adapters, considered as common fields.
Selecting an Adapter Field
The Select Adapter Field dropdown contains a list of all the fields on that adapter. In the case of the Aggregated selection in the Adapter dropdown, this is a list of all fields whose data is collated from all adapters.
Converting from Wizard to Syntax
You can construct a statement in the Wizard screen and then convert and view its Syntax.
Click the Syntax button to convert Wizard to Syntax.
The Syntax button is disabled when not all fields have been filled in the Wizard. This occurs when you don't complete a statement, including the case where you didn't yet choose a module in the Enforcement Set query and therefore cannot choose an adapter field.
When you save the Enforcement Set, the incomplete Dynamic Value statement is not saved.
Converting from Syntax to Wizard
You can construct a statement in the Syntax screen and then convert and view it in the Wizard.
Click the Wizard button to convert syntax to wizard.
The Wizard button is disabled in the following cases and a tooltip is displayed::
- The statement is too complex to display in the Wizard. Tooltip: Statement is too complex to display in wizard.
- Syntax was not validated successfully. Tooltip: Invalid statement cannot be displayed in wizard.
- You didn't yet choose a module and can therefore not choose an adapter field, as the available adapter fields are dependent on choosing a module. Tooltip: Incomplete statement cannot be displayed in wizard.
Examples
All Statement Example
The following screen shows an All statement example built in the Wizard.
The Axonius - Add Tag to Assets action runs on Vulnerability assets that match the critical vulns query.
For each vulnerability that matches the query, the statement assigns the action field Tag names the first non-empty value of the following adapter fields:
- CVE Impact Score
- CVSS V2 Score
- CVSS V3 Score
You can click the Syntax button to translate the statement constructed in the Wizard to syntax.
After saving the Enforcement Set, you can click Simulate from either above the Wizard or Syntax statement to debug the statement.
Switch/Case Statement Example 1
The following screen shows a Switch/Case statement example built in the Wizard.
For each vulnerability that matches the query, it checks if the CVSS V2 Score field in the Aggregated adapter is greater than 2 (the first condition).
If yes, the action field Tag names is assigned the value of the CVSS V2 Score adapter field.
If not, it checks if the CVSS V2 Score field in the Aggregated adapter is less than 2 (the second condition). If yes, the action field Tag names is assigned the value 0.
If none of the conditions are met, the action field Tag names is assigned the value fallback, defined as the default value in the action configuration form.
You can click the Syntax button to translate the statement constructed in the Wizard to syntax and validate it.
After saving the Enforcement Set, you can click Simulate from either above the Wizard or Syntax statement to debug the statement.
Switch/Case Statement Example 2
The following screen shows a Switch/Case example built in the Wizard.
For each device that matches the query, it checks if the Asset Name field in the Aggregated adapter meets the criteria listed in the first condition. If it does, the action field is assigned the value of the adapter field. If not, the next condition is checked. Once the Asset Name field value meets the criteria, the remaining ELSE IF conditions are not processed.
You can click the Syntax button to translate the statement constructed in the Wizard to syntax and validate it.
After saving the Enforcement Set, you can click Simulate from either above the Wizard or Syntax statement to debug the statement.
For more information about Dynamic Value statements, see the following::
Dynamic Value Statement Concepts
Creating Enforcement Action Dynamic Value Statements
Enforcement Action Dynamic Value Statement Syntax Table
Useful Tips and Tricks for Working with Dynamic Value Statements
Using the Syntax Helper
Using the Dynamic Value Statement Wizard
Using the Dynamic Value Statement Simulator
"All" Statement Syntax
Switch/Case Statement Syntax
Using Functions, Operators, and Keywords
Dynamic Value Statement Examples and Use Cases
For more information about working with Enforcement Sets, see the following:
Enforcement Center Overview
Enforcement Sets Page
Creating Enforcement Sets
Managing Enforcement Sets
Using Predefined Enforcement Sets
Testing an Enforcement Set
Creating Enforcement Action Dynamic Value Statements
Scheduling Enforcement Set Runs
Viewing Enforcement Set Run History
Duplicating Enforcement Sets
Viewing Editing and Deleting Enforcement Sets
Terminating an Enforcement Set Run
Running Enforcement Sets