How to have a Jira custom field read-only in the interface but editable using REST ?

Sorin Sbarnea (Citrix)
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 20, 2013

I have some text fields that are generated and updated using REST api.

The problem is that people are not always aware that these fields are generated and they may try to edit them, wondering days later why their change was overriden.

How can I solve this?

Note: I tried to hide the fields but if I hide them I will not be able to edit them using REST.

1 answer

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2013

I don't think there's an easy way to do this. Either a field is available for edit, or it is not.

Some thoughts include:

Use the "restricted edit" trick. For each status, add a transition to the workflow - one that does not change the status. Make it go through a screen that includes your fields, and put conditions on it so that only the user who does things via REST can use the transition. Remove the fields from all edit screens that the other people use. Possibly a total pain to code for, because your REST app will now need to work out and perform a workflow transition rather than an edit.

Put the fields on screen, and use javascript to stop them appearing on edit. I think REST ignores javascript (and even if it doesn't, then you can still code to check for the incoming change being REST based). A determined user will bypass this quite easily though.

Write new fields that know when they can be edited.

Sorin Sbarnea (Citrix)
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 20, 2013

Hi Nic,

Maybe you are not aware about the fact that global transitions are broken on REST, see https://jira.atlassian.com/browse/JRA-32132

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2013

I did not mention global transitions at all.

Although I can see my posting didn't explicitly say you have to do this separately for EACH status.

I would have mentioned them, if I didn't already know that they wouldn't work, but I apologise for being thoroughly unclear on that! I should know better and been explicit.

Sorin Sbarnea (Citrix)
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 21, 2013

Let's hope atlassian will fix them, as it seems almost impossible to add the speciall transition for all steps from all workflows...

Suggest an answer

Log in or Sign up to answer