It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using AJS to format the description

Hello, I want to display the Description of an Issue in my Plugin, but I get it in this form:

h2. Welcome to your first issue {color:#707070}An issue is an item you want to track in a specific JIRA project. You can use JIRA to track all kinds of things.{color} h4. Types of issues {color:#707070}An issue could represent a software bug, a user story, a project task, a helpdesk ticket, or a leave request form, the list is endless!{color} !IssueTypes.png! h4. Issue attributes {color:#707070}You may have noticed that an issue has some system fields such as: type, priority and status. These fields are there to help you categorise and track the progress of each issue.{color} Next: [Changing an issue's status|DEMO-2] \\ ---- [Learn more about issues|https://confluence.atlassian.com/display/JIRA/What+is+an+Issue] \\

How can I use AJS to format this,or the JiraAPI to do this?

regards

chris

2 answers

Javascript/Jquery

AJS.$(#description-val).text() will grab the description of an issue. you can trim() to remove white space. Obviously this is javascript so should be once page loads.

API

https://host:port/rest/api/2/issue/{issueid}

which will return your issue in json. Then you can assign it to a variable in javascript i.e. :

function getDescription()

{

var description;

AJS.$.ajax({

url: "/jira/rest/api/2/issue/TEST-1",

type: 'get',

dataType: 'json',

async: false,

success: function(data) {

description = data.fields['description'];

}

});

return description;

}

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Next-gen

Keyboard shortcuts have arrived for next-gen projects!

...ollected feedback from users around the lack of shortcuts, and we’re here to address that: In next-gen projects, I miss the keyboard shortcuts badly. This is particularly true on the Board, but also i...

147 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you