How to get default value for Message Custom Field via Jira REST API?

We had a customer asking if we could render the Message Custom Field (for edit) custom field type (com.atlassian.jira.toolkit:message) in the create issue form of one of our apps (the form is rendered outside the Jira context using the REST API).

How does this field work?

This is a Jira built-in custom field type that is provided by the Jira Toolkit plugin (which seems to be built into/ships with Cloud). Essentially, the field allows an admin to configure a default text value for the field which is then rendered as a read-only field in the create or edit issue form.

After some investigation, it seems this is not possible because (I assume) the implementation of this custom field is buggy or rather intentionally hacky.

Create metadata from the REST API returns the following:

GET /rest/api/2/issue/createmeta?...

{
    // ...
	"customfield_10637": {
		"required": false,
		"schema": {
			"type": "string",
			"custom": "com.atlassian.jira.toolkit:message",
			"customId": 10637
		},
		"name": "Message Custom Field (for edit)",
		"key": "customfield_10637",
		"hasDefaultValue": false,
		"operations": [
			"set"
		]
	},
    // ...
}

Strangely the field has no default value which does not make sense because the default value stores the read-only text that we would like to render. I assume this is because the custom field implementation in the Jira Toolkit plugin returns null for getDefaultValue (no clue what this comment means :thinking:):

    /*
     * Returning null here for the default value because the new quick edit plugin only forces fields to be required
     * on the create screen if they have *no* default value.  On quick edit users will still be able to remove the
     * field but that's kinda the whole point of quick-edit!
     */
    @Override
    public String getDefaultValue(final FieldConfig fieldConfig) {
        return null;
    }

Here is my question: Is there a chance Atlassian will fix this issue?

I do understand that it may not be possible to fix this because this custom field works around some limitations in the Jira API to provide the read-only functionality. If that’s the case, I guess there is no way we can render this field in a Jira external create issue form.

2 Likes

@tbinna - I’ve reached out to the Jira Cloud team that I hope will be able to provide details for you. I’ll circle back with them at the start of next week (since its the weekend). Thanks.

1 Like

@tbinna A bug related to this custom field can be found here: [JRACLOUD-72045] Message Custom Field on new issue view do not display correctly - Create and track feature requests for Atlassian products.

I recommend you chime in with your vote + comment on your use case (including on your create issue form).

Thanks, Neil. That bug report seems to be related to the new Jira issue view. In our case, it is related to the Jira REST API which is not exposing the set default value. I do not think that the new or old issue view plays a role in this, i.e. for the REST API result. I still left my comment on the issue.