Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to Create and Populate a Read-Only User Field that will be Displayed during a Transition

David b September 6, 2015

I have a transition screen which includes a user picker. To allow the end user using that transition screen to make an informed business decision I have a requirement to display a readonly field containing the username of a user who completed a particular prior step. EDIT: The source is a custom user picker field and not the assigned field.

I have tried a custom read-only field and a post function field to field copy however it errors presumably because the source is a user field and the destination is a text field.

It seems like a really obvious common sense business requirement to be able to have fields as display only on a transition form yet I cannot seem to figure out how to do it.

How do I achieve this requirement?

 

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
David b September 7, 2015

I ended up building a plugin "Visible Readonly Text Field" to achieve this. Of course it's necessary to maintain 2 separate fields for the same value and to copy the value from field to field. Display the readonly field on all the display transition screens and the user picker field on the assignment transition. It's awkward having 2 fields but at least this custom field type actually displays on a transition screen and because of that this solution works.

I setup a centos VM dev environment with eclipse to do it. The trick was finding the velocity scripts that come with JIra and merging the view-basictext.vm view functionality into the new edit-jirareadonlytext.vm edit script.

Source and plugin are attached to save others the effort.

 

Justin Alex Paramanandan
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.
May 11, 2016

Quick question @David b: is your plugin compatible with older releases of JIRA (such as JIRA 6.3.x)? Your plugin has been a great addition to one of my requirements. smile

David B May 11, 2016

Officially I have no idea what versions it will work with. It's about as simple as a custom field can get so I expect it should work. The source is there so it should be possible to rebuild it against an older version if you need to.

Justin Alex Paramanandan
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.
May 11, 2016

Thanks! I'll cross-check this, and see how it goes. smile

0 votes
Lipun May 12, 2016

You can use script to make fields readonly.

 

document.getElementById('customfield_id').disabled =true;
document.getElementById('customfield_id').style.background="silver";

0 votes
MattS
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.
September 9, 2015

You can make fields readonly by only adding them to the view screen. The error when copying sounds like a different problem

David b September 9, 2015

Thanks! That's exceptionally handy when the business requirement is to display it on a transition screen.

0 votes
Volodymyr Krupach
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.
September 6, 2015
David b September 6, 2015

"Copy Value From Other Field" errors when the source is a custom field of type user picker. The example shows "assigned" which works but my scenario doesn't. The secondary issue i'm discovering is that the read-only field refuses to actually display on a transition screen

Volodymyr Krupach
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.
September 6, 2015

Looks like you need to write your own post-function. You can utilize Script Runner to save on addon creation.

David b September 7, 2015

Sadly a steep learning curve for fundamentally basic functionality. Plus the refusal to display a readonly field on a transition screen would constitute a bug as there's no way a post function can make a field display.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events