---
title: "Get the Default Value of a Custom Field"
canonical: "https://support.appfire.com/space/JMWE/461439452/Get%20the%20Default%20Value%20of%20a%20Custom%20Field"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet gets the default value of a specific custom field.

### Logic

Access the custom field by its name, get its relevant configuration for the current issue and then get its default value.

### Snippet

```groovy
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.fields.config.FieldConfig

CustomFieldManager customFieldManager = ComponentAccessor.customFieldManager;
CustomField customField = customFieldManager.getCustomFieldObjectByName("<Custom field name>")
FieldConfig relevantConfig = customField.getRelevantConfig(issue);
customField.getCustomFieldType().getDefaultValue(relevantConfig)
```

### Placeholders

| Placeholder | Description | Example |
| --- | --- | --- |
| `<Custom field name>` | <span style="color: #333333">Name of the custom field</span> | `Checkboxes` |

### Examples

<span style="color: #333333">The outcome of the code snippet is a </span>`String` or <span style="color: #333333">an </span>`array of Strings (String[])`<span style="color: #333333"> or an object or a collection of objects which depends on the custom field specified. You could use this code for example to: Set a checkboxes field value to its default value using one of the Set field value post-functions when the default value of the field changes often.</span>

### References

- [issue interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461537734)
- **[Groovy Documentation](http://groovy.codehaus.org/User+Guide)**

### Related articles

> Macro (contentbylabel)

> Macro (details)
> 
> | Related issues |  |
> | --- | --- |