---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Presentation Components, widgets, tags, UI components]
nav: wcp_docs
parent_url: /wcp_docs/
title: instanceLoop
layout: subsection
wd_wcptag: instanceLoop
---

<a id="section_N10021_N1001E_N10001"></a>
Creates instances for widgets that display instance lists such as multiselect check boxes, radio button, drop-down lists, and others.

Use `instanceLoop` on view and edit pages.

Use `instanceLoop` with the `instanceListLoopTag` property of these list tags:

-   checkBoxList
-   dropdown
-   instanceList
-   panelList
-   radioGroup


## <a id="section_wgb_gpn_h2b"></a>Example

This sample `instanceLoop` iterates through `workers.data`, and creates instances in a `checkBoxList` using the `templateInstance`.

```
{
  "type": "checkBoxList",
  "label": "instanceListLoopTag for checkBoxList",
  "id": "checkBoxListInstanceListLoopTag",
  "instanceListLoopTag": {
    "id": "workerList",
    "type": "instanceLoop",
    "templateInstance": {
      "id": "<% instance.id %>",
      "descriptor": "<% instance.descriptor %>"
    },
    "on": "<% workers.data %>",
    "as": "instance"
  }
}
```

The sample `workers` endpoint:

```
{
  "baseUrlType": "workday-staffing",
  "name": "workers",
  "authType": "sso",
  "url": "<% '/workers?limit=10' %>"
}
```

This sample `instanceList` on a view page uses the `instanceLoop` with the `wid` attribute to enable the related actions menu and view link on the instances.

<b>Note:</b> By default, the presence of the `wid` attribute enables both the related actions menu and view link on an instance. To disable the view link and display it as plain text, set the `view` attribute of `instanceList` to `false`. To disable the related actions menu, set the `relatedTask` attribute of `instanceList` to `false`.

```
{
  "id": "workerInstanceList",
  "type": "instanceList",
  "label": "Hover on these instances to see their related actions menus.",
  "instanceListLoopTag": {
    "type": "instanceLoop",
    "templateInstance": {
      "id": "<% workerInstance.id %>",
      "descriptor": "<% workerInstance.descriptor %>",
      "wid": "<% workerInstance.id %>"
    },
    "on": "<% workers.data %>",
    "as": "workerInstance"
  }
}
```

## <a id="section_mobileSupport"></a>Mobile Support

Android, iOS

## <a id="section_qpw_1kc_ccb"></a>Attributes

-   <b>as</b>

    Data type: string

    Required. A string that references the current iteration in the list provided by the `on` attribute.

-   <b>id</b>

    Data type: binding-String

    Unique identifier used to reference this widget from other tags.

    Notes:

    -   The `id` must start with a letter.
    -   The `id` must be unique per page.
    -   To enable other widgets to reference this widget `id`, place this widget before the other widgets on the PMD. The PMD validation returns an "Undefined variable" error if it doesn't find a previously defined `id` in the PMD.
    -   Workday recommends that you include the `id` in your tag definitions for debugging purposes.

-   <b>limit</b>

    Data type: integer

    A number that limits the number of iterations. Example: If `limit` is 4 and the `on` attribute contains 6 items, then the loop only iterates 4 times. If you don't specify `limit` or if you set it to `-1`, the loop iterates through all the data listed in the `on` attribute.

-   <b>on</b>

    Data type: dynamicBinding-Collection

    Required. The list of values to iterate with an `instanceLoop`. This data collection must have ID and description fields. Specify the `id` and `descriptor` fields in `templateInstance`.

-   <b>templateInstance</b>

    Data type: instance

    The template for an item in the instance list. Specify the `id` and `descriptor` fields to use with the template instance.

    Example:

    ```
    "instanceListLoopTag": {
    "id": "instanceLoopWithWid",
    "type": "instanceLoop",
    "templateInstance": {
      "id": "<% thisInstance.primaryJob.jobProfile.id %>",
      "descriptor": "<% thisInstance.primaryJob.jobProfile.descriptor %>"
    },
    "on": "<% workersEndpoint.data %>",
    "as": "thisInstance"
    }
    ```

    <b>Note:</b> To enable the related actions menu and view link, set the `wid` attribute. Specify the binding to the ID field containing the instance Workday ID. For details, see Enabling the Related Actions Menu in [instanceList](/wcp_docs/hcb1512514976081.html).



