---
keyword: [Extend, PMD Scripting, Scripts, Graph API]
nav: wcp_docs
parent_url: /wcp_docs/
title: createIds(ids, idType)
layout: subsection
---

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

Returns a list of instance ID objects for Graph API mutations. Converts each non-null `id` in the specified list of IDs into one instance ID object. Each object has a type of `idType`.

Returns null if the `ids` list is null.

Returns an empty list if the `ids` list is empty.

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

List of maps

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

```
graph:createIds(ids, idType)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>ids</td><td>List of strings. A list of IDs.</td></tr><tr><td>idType</td><td>String. The type of the Graph API instance ID object.</td></tr></tbody></table><br/>

<b>Examples</b>

`graph:createIds(['ID1', 'ID2'], 'ID_TYPE')`

Returns

```
[
    {
        "id": {
            "id": "ID1",
            "type": "ID_TYPE"
        }
    },
    {
        "id": {
            "id": "ID2",
            "type": "ID_TYPE"
        }
    }
]
```

`graph:createIds(null, 'ID_TYPE')`

Returns `null`.

`graph:createIds([], 'ID_TYPE')`

Returns `[]`.

