updating custom field jira rest api

Ankit kharola March 9, 2025

i have created a workflow and a transition in that where if a user wants to transition the status of issue from to do to in progress a custom field analysis should be filled and i am trying to transition the issue via rest api i am getting the custom field which is required but when i am trying to update the field i am getting an error 

Error transitioning issue: Error: Failed to transition issue: 400 Bad Request. {"errorMessages":[],"errors":{"customfield_10038":"Operation value must be an Atlassian Document (see the Atlassian Document Format)"}}   this is the resolver function 

 

resolver.define("transitionIssue", async (req) => {
  const { issueId, transitionId, fields  } = req.payload;
  console.log(fields, "custom")
  try {
    // Make a POST request to transition the issue
    const response = await api
      .asApp()
      .requestJira(route`/rest/api/3/issue/${issueId}/transitions`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          transition: {
            id: transitionId,
          },
          fields : fields
        }),
      });

    // Check if the request was successful
    if (!response.ok) {
      const errorResponse = await response.json();
      throw new Error(
        `Failed to transition issue: ${response.status} ${response.statusText}. ${JSON.stringify(errorResponse)}`
      );
    }

    // Return a success message
    return { success: true, message: "Issue status updated successfully!" };
  } catch (error) {
    console.error("Error transitioning issue:", error);
    throw new Error(`Failed to transition issue: ${error.message}`);
  }
});  this is the custom field value i am getting from frontend 

{ customfield_10038: 'hello' }

1 answer

1 accepted

0 votes
Answer accepted
Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2025

@Ankit kharola 

What is the type of field that you are using for customfield_10038?

ADF (Atlassian Document Format) is expected for fields like description. if you are okay to have a simpler use case, I would suggest that you change the type of the field. Else you will need to follow ADF guidelines while updating the field like first field should be "version": 1, etc.

Atlassian Document Format

Ankit kharola March 10, 2025

Hello sir @Vishal Biyani  the type of the custom field is Text Field (multi-line) 

Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2025

in that case can you try setting customfield_10038 like this and see if works for you.

"customfield_10038 ": {
"version": 1,
"type": "doc",

"content": [{
"type": "paragraph",
"content": [{
"type": "text",
"text": "hello"
}
]
}
]
}
 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events