Dave Slusher

4 minute read

Dynamic Inputs

One of the great features in the New York release is the inclusion of Dynamic Inputs. It can be tedious to develop a Flow when it requires a script step to transform data from one form to another. Dynamic Inputs to the rescue!

Imagine the case where the inputs to an Action inside of a Flow are based on the data outside of your instance such as creating a record in an external system. The tables in the other system change over time but the Action developer

  • doesn’t want to allow for free form input because it must be a valid table in the other system
  • doesn’t want to maintain a list of valid tables because who would?
  • would prefer a dynamically populated list

That is exactly what Dynamic Inputs provide. When the data necessary for an input to an Action live externally, an integration fetches that information and makes it available. To be clear, this is occurring at design time, so they are values relevant while authoring or editing the Flow. This is not a runtime integration but a convenience for the designer.

To add a Dynamic Input to an Action, select Dynamic Choice or Dynamic Template as the input type. If selecting Dynamic Choice, then there will be a dropdown of available “Data Gathering Actions” (which will be discussed shortly). By selecting one of those, that is defining this input to the Action as a value that will come from that list.

Creating Data Gathering Actions

Data Gathering Actions are also actions with a specific simple contract. Any Action that has an output variable named “output” of type JSON will show up on that list. In order to actually by consumable by the input, the JSON object needs to contain a “data” element that is an array of objects containing a “name” and a “label” like this:

{"data": [
    {"name":"cool_thing_1",
    "label": "First Cool Thing"},
    {"name":"cool_thing_2",
    "label":"Second Cool Thing"}
  ]
}

After that Data Gathering Action exists, then it will be an option as a Dynamic Choice for future Actions.

Choose a Data Gathering Action for the Dynamic Choice

Using Dynamic Choices

After creation of the Data Gathering Action (or getting it via a supplied integration in a Spoke) and configuring the input on the Action, it is time to use it!

When that configured Action is then added to a Flow at design time, the integration will run and populate the list. These will be presented as choices in the UI. What is seen in the choice will be what is in the “label” field of the JSON object, and what is configured in the action is the contents of the “name” field.

Use the Dynamic Value

This will ease the management burden for Actions that exist to interact with other systems and should become quite common over time as the variety of Spokes delivered by ServiceNow and third parties expand.

SSH Steps

The long term goal is to bring IntegrationHub up to feature parity with Workflow. One of the steps towards that is the SSH Step, which is now available to be used in custom actions.

Note - this is a feature that requires the IntegrationHub Professional Pack Installer plugin be activated.

By defining the connection and credential alias to be used, then the ssh command and optional working can be specified. The results of the output are then available as a data pill to subsequent Steps in the Action. If this might be a step that takes over 120 seconds, select the Long Running option. This will prevent the default timeout from killing the ssh connection

Configure SSH Step

JDBC Steps

Similarly, when creating an Action there is now a step for JDBC integration.

Note - this is a feature that requires the IntegrationHub Professional Pack Installer plugin be activated.

Configure JDBC Step

Once the JDBC step is configured, the outputs of this step will be available to subsequent steps of this Action. The number of rows will be available, as well as the results of the query in JSON format.

JDBC Outputs Available as Data Pills

Conclusion

IntegrationHub continues to make strides to achieve parity with Workflow. This new functionality increases the radius of what can be achieved with Flows and IntegrationHub. For those developers looking to simplify Workflows, make that functionality available to a wider population or simply get more done faster these are features worth a look.

Build something wonderful and let us know in the comments how your experiments turn out!


Comments