---
title: "getCustomFieldIdByName"
canonical: "https://support.appfire.com/space/PSJ/15483620/getCustomFieldIdByName"
format: markdown
---
> Macro (aura-html)


|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | getCustomFieldIdByName(customfieldName); | **Package** |  |
| **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Returns a list of ids for all custom fields with the given name.

Returns a list of ids for all custom fields with the given name.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| customfieldName | String | Yes | Name of custom field to retrieve ids for. |

## Return Type

**String []**

Returns an array of custom field ids.

## Examples

### Example 1

```
return getCustomFieldIdByName("My Custom Field");
```

Returns: "customfield_10101"

### Example 2

This example has multiple custom fields for a single name.

```
string myCustomField;
for(string id in getCustomFieldIdByName("My Custom Field")) {
    //check the context for the calling issue to determine which custom field to use
    if(isCustomFieldInContext(id, projectKey, issueType) {
        myCustomField = id;
    }
}

return myCustomField;
```

## See also

> Macro (contentbylabel)