---
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, PMD Scripting, Scripts]
nav: wcp_docs
parent_url: /wcp_docs/
title: add (list, object, index)
layout: subsection
---

## <a id="section_m3p_myb_5db"></a>Description

Adds an object at an index position in a given list, and returns the result. Currently this function only applies to nonprimitive types (that is, adding to a list of strings won't work as expected).

## <a id="section_cyq_j1m_zsb"></a>Return Type

`List`

## <a id="section_dz5_pwg_5db"></a>Namespace Function Syntax

```
list:add(list, object, index)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>list</td><td>A list of map objects.</td></tr><tr><td>object</td><td>A value to add to the list</td></tr><tr><td>index</td><td>A zero-based index position of the new value in the list.</td></tr></tbody></table><br/>

<b>Example</b>

Assume:

-   <i>theList</i> is <i>[{"key1": "value1"}]</i>
-   <i>addThisObject</i> is <i>{"key2": "value2"}</i>


`list:add(theList, addThisObject, 0)`

Returns `[{"key2": "value2"}, {"key1": "value1"}]`

