How to update customfield in cloud using forge

Hello Team,
I’m new to JIRA Cloud and trying to develop a small app using Forge. My requirement is to update a Text Customfield value with the current Issue Description. Can someone help with the code

Also. I see that when using rest/api/3/ description field is comming as array when compared to rest/api/2/. May i know what is the correct way of getting the value of description field using rest api

{"expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations","id":"10000","self":"https://XXXX.atlassian.net/rest/api/3/issue/10000","key":"TES-1","fields":{"description":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"testLin1"}]},{"type":"paragraph","content":[{"type":"text","text":"test Lone2"}]},{"type":"paragraph","content":[{"type":"text","text":"TestLine3"}]}]}}}

if i use rest/api/2 then

{"expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations","id":"10000","self":"https://XXXX.atlassian.net/rest/api/2/issue/10000","key":"TES-1","fields":{"description":"testLin1\n\ntest Lone2\n\nTestLine3"}}```

Welcome to the Atlassian developer community @ChandraSekhar1,

The difference is explained at the top of the REST API reference docs:

This documentation is for version 3 of the Jira Cloud platform REST API, which is the latest version but is in beta. Version 2 and version 3 of the API offer the same collection of operations. However, version 3 provides support for the Atlassian Document Format (ADF) in:

  • body in comments, including where comments are used in issue, issue link, and transition resources.
  • comment in worklogs.
  • description and environment fields in issues.
  • textarea type custom fields (multi-line text fields) in issues. Single line custom fields (textfield) accept a string and don’t handle Atlassian Document Format content.

In short, the Atlassian Document Format (ADF) is a JSON-based representation of “document like” fields. If it’s a problem to work with that format, I’d recommend continuing to use the v2 APIs.

2 Likes

A post was split to a new topic: Manipulating ADF in a Forge App