Forge Custom field can't edit default Value by /rest/api/3/field/{fieldID}/context/defaultValue API

Hey Forge Team.

Jira provides the following endpoint https://Youdomain.atlassian.net/rest/api/3/field/customfield_10051/context/defaultValue to modify the default value of the custom field with the following request:

PUT /rest/api/3/field/customfield_10052/context/defaultValue HTTP/2
Host: YourDomain.atlassian.net
User-Agent: Mozilla/5.0
Content-Type: application/json
Content-Length: 113
Cookie: <Admin-Cookies>

{  "defaultValues": [ {  "contextId": "10152", "text": "TEST","type": "textarea"  } ] }

When creating a custom field using Forge of type string I tried to modify the default value of the field through the same request attached previously, but the server replied that there was an error in the custom field type I tried to change the value of the parameter “Type”:

{ “defaultValues”: [ { “contextId”: “10152”, “text”: “TEST”,“type”: “string” } ] }
{ “defaultValues”: [ { “contextId”: “10152”, “text”: “TEST”,“type”: “text” } ] }
{ “defaultValues”: [ { “contextId”: “10152”, “text”: “TEST”,“type”: “textarea” } ] }

but the following error keeps appearing

HTTP/2 400 Bad Request
Server: AtlassianProxy/1.19.3.1
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
....

{"errorMessages":["Could not resolve type id 'String' into a subtype of [simple type, class com.atlassian.jira.bc.customfield.defaultvalue.CustomFieldContextDefaultValueBean]\n at [Source: org.apache.catalina.connector.CoyoteInputStream@12096bbc; line: 5, column: 19] (through reference chain: com.atlassian.jira.bc.customfield.defaultvalue.update.CustomFieldContextDefaultValueUpdateRequestBean[\"defaultValues\"])"]}

So please, could you tell me the type of Forge custom field that I should use so that I can modify the default value of the field through the previous request.

Best,

  • Jafar

Hello, @JafarAboNada,

This API is not supported for Forge custom fields yet.

Hi @kkercz

Thank you for your reply. Is there another way that I can modify the default value of the custom field through the Forge app.

Best,

I’m afraid right now setting default values of Forge custom fields can be done only by Jira admins in the UI. We will look into prioritizing the work to make it possible using the REST API.

1 Like