Hide fields based on status using JQuery or Java script

Anoop Wilson
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.
December 12, 2011

I need to hide some fields in Edit screen based on the status(open,resolved etc) of the issue.How can I get the status in Jquery or Java script

2 answers

1 accepted

0 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
December 12, 2011

Status won't be there on the edit screen.

You might want to use workflow operation to edit the fields where you can direct to different transitions based on workflow status each have a different screen!

1 vote
JamieA
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.
December 12, 2011

It's not on the screen but you can get it like this:

AJS.$.get(AJS.params.baseURL + "/rest/api/2.0.alpha1/issue/" + AJS.$("#key-val").text(), function (data) {
    console.log (data.fields.status.value.name);
})

BTW you can do this with the behaviours plugin without writing any code.

Jobin Kuruvilla [Adaptavist]
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.
December 12, 2011

Ah REST! Nice one..

Anoop Wilson
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.
December 18, 2011

thanks Jamie

Anoop Wilson
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.
January 9, 2012

Hi Jamie,

I am not able to store the status in a variable.My intention is to hide some fields in the "Edit Screen" base don the status.

Regards

Anoop

JamieA
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.
January 9, 2012

So, if data.fields.status.value.name is Opened, then you hide the field. You should try this with the behaviours plugin, no coding is required at all for hiding fields based on status.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events