Can a READ-ONLY custom field be cleared via Automation or API

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

You have created a READ-ONLY custom field and you would like to make the field EMPTY but when you try to clear this field via Automation or API by setting a EMPTY value it doesn't work. A READ-ONLY custom field can't be set to an Empty value no matter what.

Diagnosis

NA

Cause

Currently, we have a Bug with our Jira cloud API - JRACLOUD-77845 and a feature request with automation - AUTO-614 which addresses this limitation with READ-ONLY fields. Until these requests are implemented we are blocked from adding empty values.

Solution

This is not a direct solution but rather a workaround if you have a use case where you want the field to look empty.

  1. If you have a compelling use case where you want the READ-ONLY field to look empty then you can add a "Blank Space" via API endpoint PUT /rest/api/3/issue/{issueKeyOrId}.

  2. The request body should be as below

    1 2 3 4 5 6 { "fields": { "customfield_<customfield_id>": " " } }

  3. Below is a sample curl request

    1 2 3 4 5 6 7 8 9 10 curl --request PUT \ --url 'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "fields": { "customfield_<customfield_id>": " " } }'

Note: Adding a blank space is not the same as leaving the field empty or clearing it. Hence, this does affect other places where you may refer to this custom field. For example, In JQL you would need to search for blank space like CustomField = " " instead of using CustomField is EMPTY.

Updated on May 31, 2024

Still need help?

The Atlassian Community is here for you.