<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
How to Use and Test the Pluck Card in Workflows
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

This guide will teach how to use and test the List – Pluck card.

Applies To
  • Workflows
Solution

Creating a sub-list with the Pluck card

The List – Pluck card takes a list of objects and a key and produces a sub-list. It does that by using the key to pluck the key values. These values become the sub-list.
 Pluck card

The following are several examples.


The input list is:

[
    {
        "product": "apple"
    },
    {
        "product": "tuna"
    },
    {
        "product": "bell peppers"
    },
    {
        "product": "milk"
    }
]

The key is product. After pluck, the resulting sub-list is:

["apple","tuna","bell peppers","milk"]

The following example uses a similar list:

[
    {
        "product": "apple",
        "type": "fruit"
    },
    {
        "product": "tuna",
        "type": "fish"
    },
    {
        "product": "bell peppers",
        "type": "vegetable"
    },
    {
        "product": "milk",
        "type": "dairy"
    }
]

The key is product. After pluck, the resulting sub-list is the same:

["apple","tuna","bell peppers","milk"]

The next example shows a more complex JSON list:

[
    {
        "properties": {
            "sheetId": 0,
            "title": "Sheet1",
            "index": 0,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 1000,
                "columnCount": 20
            }
        }
    },
    {
        "properties": {
            "sheetId": 317732887,
            "title": "Sheet2",
            "index": 1,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 1010,
                "columnCount": 15
            }
        }
    },
    {
        "properties": {
            "sheetId": 2125125274,
            "title": "Sheet3",
            "index": 2,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 1500,
                "columnCount": 22
            }
        }
    },
    {
        "properties": {
            "sheetId": 144976084,
            "title": "Sheet4",
            "index": 3,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 900,
                "columnCount": 10
            }
        }
    },
    {
        "properties": {
            "sheetId": 1179906118,
            "title": "Sheet5",
            "index": 4,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 1300,
                "columnCount": 8
            }
        }
    },
    {
        "properties": {
            "sheetId": 1615383701,
            "title": "Sheet6",
            "index": 5,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 2000,
                "columnCount": 30
            }
        }
    },
    {
        "properties": {
            "sheetId": 561243345,
            "title": "Sheet7",
            "index": 6,
            "sheetType": "GRID",
            "gridProperties": {
                "rowCount": 500,
                "columnCount": 5
            }
        }
    }
]

The key can be dot-delimited. Using the properties.gridProperties for key, the card creates the following list:

[
  {
    "rowCount": 1000,
    "columnCount": 20
  },
  {
    "rowCount": 1010,
    "columnCount": 15
  },
  {
    "rowCount": 1500,
    "columnCount": 22
  },
  {
    "rowCount": 900,
    "columnCount": 10
  },
  {
    "rowCount": 1300,
    "columnCount": 8
  },
  {
    "rowCount": 2000,
    "columnCount": 30
  },
  {
    "rowCount": 500,
    "columnCount": 5
  }
]

Testing the Pluck card

There are several options for testing the Pluck card.


The first option is to enter each list item directly when testing. Click the row and enter a list item:
 

Adding list items 


Testing the Pluck card with four items list:
 

Testing the Pluck card 


This approach works but can be time-consuming if the list is complex or extensive.


Test the entire flow for quick testing. Use the JSON – Parse card to create a JSON list and pass it to the Pluck card. Then, test the flow.
 

The Pluck card in a flow 


Execution history shows the Pluck card result:
 

Testing the Pluck card as part of a flow 

Related References

Loading
How to Use and Test the Pluck Card in Workflows