Set Up API Connector Dynamic Input Fields in the Okta Workflows Connector Builder

This blog post will teach you how to set up dynamic input fields on an API connector action in the Okta Workflows Connector Builder. Your card will look like this:

connector input final three

Action card with dynamic input fields.

  • Create API connector tutorials.
  • Set up API connector dynamic input fields.
  • Resources.

Create API connector tutorials

In two previous blog posts, you learned how to create a connector with static input fields:

You also learned how to set up output fields in:

Set up API connector dynamic input fields

Action dynamic input fields allow you to load input values based on another field selection.

You can set up dynamic input fields in two ways:

  • An option field controls another option field.
  • An option field controls an input field.

An option field controls another option field

Click Edit in a connector action to start setting up action options.

connector inputs edit

Connector action options.

The action has three option input fields:

  • Division.
  • Department.
  • Region.

All three fields have Field Type set to Dropdown.

connector inputs three options

Action with three option fields.

Expand (click the down arrow on the right side) the Division field to see its details. Division is a static field with two options (Hardware and Software):

connector inputs option details

Division options field.

Next, expand the Department option field. The Department field gets its values from a helper flow.

  1. The Department dropdown gets its values from the Department List helper flow.
  2. Since the Department dropdown depends on a value from the Division dropdown, the Division value maps to the helper flow, which returns a list in JSON format.
  3. Preview output shows a helper flow JSON output.

connctor inputs option details helperflow 1

The Department options field uses a helper flow for its values.

When you select the Hardware division, the helper flow loads the following JSON with three divisions:

[
 {
   "value":"Systems",
   "key":"Systems"
 },
 {
   "value":"Embedded",
   "key":"Embedded"
 },
 {
   "value":"Supply Chain",
   "key":"Supply Chain"
 }
]

The list looks like this:

connector inputs hardware options

Hardware department list.

When you select the Software division, the helper flow load the following JSON with three different divisions:

[
 {
   "value":"Engineering",
   "key":"Engineering"
 },
 {
   "value":"Quality Assurance",
   "key":"Quality Assurance"
 },
 {
   "value":"IT",
   "key":"IT"
 }
]

The list looks like this:

connector inputs software options

Software department list.

The Department List helper flow looks like this:

connector inputs departmentlist helperflow 1

Department List helper flow.

The Helper Input == ‘Hardware’ if-condition returns the hardware list JSON:

connector inputs helper flow if

Hardware If list.

A value of Software will return the software list.

This section showed you how to create a dynamic input field in action Options.

  • When you choose Hardware, the Department list gets the Hardware department values from a helper flow.
  • When you choose Software, the Department list gets the Software department values from a helper flow.

In the next section, you will learn how to select a value in Options and load the list in Inputs.

An option field controls an input field

This option works similarly. You select a list value in Options, and a list is loaded in the Inputs section based on that value.

You select a region (DE - for Germany):

connector input region names de

Setting a region

The People list loads names from the DE region:

connector input region names

People list.

The setup is similar to what you saw in the previous section.

The Options has a static Region list (country list).

connector input region

Region list.

The selection from the Region field is used as input into a helper (Employee List) flow to load the people from that region.

connector input region2 1

People list.

In the previous section, the helper flow used if-else logic to create a dynamic list. In this example, the helper flow calls an API to get the list.

The helper flow looks like this:

connector input region helper flow1

Flow to get people from a region.

The helper flow has the following steps:

  • The Helper Flow card has Region input.
  • The Compose sets up a URL. The example uses Random User API.
  • The Raw Request card calls the API.
  • The Get card gets the results object that holds the people list.
  • The helper flow needs to return a JSON object representing the list values. The Map card takes the list and returns a JSON list below.
  • The Return card returns the list.

JSON to create a dropdown list:

[
  {
    "value": "Sekleta Lesko",
    "key": "Sekleta Lesko"
  },
  {
    "value": "Sacha Thomas",
    "key": "Sacha Thomas"
  },
  {
    "value": "Jamie Price",
    "key": "Jamie Price"
  },
  {
    "value": "Terra Hamilton",
    "key": "Terra Hamilton"
  },
  {
    "value": "Gerald Küsters",
    "key": "Gerald Küsters"
  }
]

The Map card calls the following flow to set up list values in JSON format:

connector input region helper flow2

Set up list values in JSON format.

This section showed you how to create a dynamic input field in action Inputs.

  • You make a Region selection in Options. In Inputs, an input field is loaded with names based on the selected region.

The final card looks like this:

connector input final three

Action card with dynamic input fields.

After an automation builder using the connector makes selections, you can use the fields in other flow cards:

connector input flow final1

Using fields in other flow cards.

Resources

📚 Building a Custom Connector in Okta Workflows, a Video Series.

📖 Okta Workflows Connector Builder documentation.

🍫 Get help from Workflows specialists during weekly community office hours.

📺 Learn from Workflows videos.

🛟 Get help from support: discuss a Workflows topic or ask a question.

🙋🏻‍♀️ Get help from the community: join the #okta-workflows channel on MacAdmins Slack.

Tags

Workflows