Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Have a Version Picker field that displays the version list of one or more other project sites

Dan Hellings February 7, 2018

We have a one master defect project site, and two other project sites that act as a filter and when the observation is put in the Approved closure status that record is cloned and created in the master defect project with a link between the two. The issue we have is that we want the master list of versions to be on the master defect project site, but records created in the other sites still need to be able to select the versions from the master list. How can we setup a version picker field in other project sites, where the version values are those that are listed in another project? 

We have Adaptavist scriptrunner, so I imagine we can achieve this via a scripted field or a behaviour. Could someone provide the details of what we need to enter to achieve this functionality?

Thanks

2 answers

2 votes
Brittany Wispell
Community Champion
February 7, 2018

Hey @Dan Hellings You can achieve this with scriptrunner. 

Use a behaviour on a textfield and create initialiser script function. 

Screen Shot 2018-02-07 at 6.04.00 PM.pngScreen Shot 2018-02-07 at 6.04.52 PM.png

Brittany Wispell
Community Champion
February 7, 2018

Here's a good documentation link to do something like this. 

Behaviour Conversions

Dan Hellings February 8, 2018

Thanks @Brittany Wispell , If i was to use the behaviour on a text field, do you know what code i would have to enter in order to display the version list of one or more project sites? 

The examples of the code that I need to write are the following:

1) A custom field in Project Site A that allows the user to select one or more versions from the Version list of Project Site B.  

2) A custom field in Project Site A that allows the user to select one or more versions from the Version list of Project Site B, Project Site C and Project Site D.  

Apologies but i do not specialise in coding, so any help would be really appreciated. 

Brittany Wispell
Community Champion
February 8, 2018

Hey @Dan Hellings

Here is an example.  You'll need to put this in a behaviour. It is located separately from the rest of the ScriptRunner options.

Screen Shot 2018-02-08 at 10.32.28 AM.png

 

//Behaviour//
getFieldByName("TextFieldA").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 : "project = SSPA ORDER BY key ASC",
label : "Pick high priority issue in Support project",
showSubTasks: false,
// specify maximum number of issues to display, defaults to 10
// max : 5,
],
formatResponse: "issue"
],
css: "max-width: 500px; width: 500px",
])

Or you could use the Atlassian Rest API.

Here is a link to documentation.

Rest API Project Get Project Versions

 

Hope this helps!  

Dan Hellings February 12, 2018

Hi @Brittany Wispell,

the above behaviour produces a list of issues to pick from. My request is to be able to select from a list of Releases/Versions. What code would I have to add to be able to sget this functionality?

Also when you select an item, only the Key is displayed in the view screen. Is there anyway to show the Key and summary?

Thanks again,

Dan 

Brittany Wispell
Community Champion
February 12, 2018

Hi @Dan Hellings you'll have to modify the code and use the information from the rest api to return the versions.  The code I provided is a starting out point. 

0 votes
Gezim Shehu [Communardo]
Community Champion
December 31, 2018

@Dan Hellings

Were you able to solve this?

Suggest an answer

Log in or Sign up to answer