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

Populating the description using convert to single select in jira script

Hi,

I've been working on populating a custom field by converting the text box into drop down by referring to 

https://scriptrunner.adaptavist.com/4.3.5/jira/behaviours-conversions.html

 

I was able to narrow down the desired list. However, when I choose the list from the drop down,  summary of the selected value is not populated where we could see only the key for the selected value. Eg: If I selected ABC21 - Test from the drop down, then only ABC21 is populated in the custom field. I've been using JQL query to fetch the resultant set in the drop down. 

 

Can anyone help in populating the field along with the summary.

1 answer

0 votes

What you are describing is the default behavior using the example in the documentation.

To help you further, it would help to see your exact code.

This is what it looks like in my test:

2019-11-04 19_37_30-Edit Issue _ JSP-1922 - JIRA Test - Corporate Issue Tracker - https___projects-t.png

Hi @Peter-Dave Sheehan ,

 

Yes,  the default behavior displays as you provided in the screenshot. But when I click on update the task number will be updated only as JSP-3. The summary is not updated.

I've used the below code for retrieval of lists. 

getFieldByName("ABC").convertToSingleSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner-jira/latest/issue/picker",
query: true, // keep going back to the sever for each keystroke

// this information is passed to the server with each keystroke
data: [
currentJql : ajaxQueryString + ajaxQueryString2,
label : "Products: "+productNames,
showSubTasks: true,
max : 100,
],
formatResponse: "issue"
],
css: "max-width: 500px; width: 500px",
])

Ah, I see. You are right.

The view screen only shows the Issue Key. And when you open the edit screen again, the dropdown shows only the issue key.

This is not surprising because the database only stores the key in that text field. 

I think that's how it's designed to work. 

You could make a feature request/suggestion with Adaptavist to have that default behavior changed. 

The best I can offer as a suggestion is to have a different behavior script that looks for an existing value and then puts the summary for the linked issue in the field's description (below the dropdown).

This won't help with the view screen. The only workaround would be to have a scripted field that loads the linked issue details and display the issue key and summary. You would hide your linked issue field and display this calculated field on the view screen.

I hope this helps.

Hi @Peter-Dave Sheehan ,

 

Thank you for your suggestion. I've populated both the key and the summary by writing a listener during the updating event to fetch the summary by using the key.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

365 views 1 3
Join discussion

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