How to get date from fixed version and copy to specific attribute?

Hi All,

I have added filed like solution available date filed

The thing is automatically set everytime the ticket is edited based on the earliest date of the field "fix version".

Take into account that fix version is a multiple choice field, so we would need to choose the earliest of them.

Thank in Advance.

suresh.

2 answers

1 accepted

1 vote
Accepted answer

You could write yourself a new calculated custom field (instructions here) and put code in the getValueFromIssue method to loop through your issue's fix versions to get the earliest release date.

Calculated fields are automatically recalculated every time the issue is updated.

So i need to develope plug-in.Once i have done calculated custome filed i have to add the custome fileds to corresponding screen.

Is it correct?

Do you have any sample snipts for this so the that i can fallow(logic inside getValueFromIssue method)

B'coz I am to the JIRA API.

thanks

That's correct.

You've looked at the link I gave? It contains links to pages explaining how to set up your plugin development environment. The 'Last commented user calculated field' example is close to what you need except you'll have to replace the comment logic with your earliest fix version release date logic.

See the JIRA API for details of the available methods that you could use. The Issue and Version classes are the ones you'll need - look at Issue.getVersions() and Version.getReleaseDate().

Yes i have seen and i have done plug-in

In the getValueFromIssue method i am getting fix version from issue.

1.But how to get the release date (from that how get instance to the version Interface so that i ll call release date).

2.Once i ll get the release date How i can set in the vm file

in method getValueFromIssue returns "releaseDate"

and vm file value="$releaseDate" Is it ok???

<input type="text" name="Sloution available Date" value="${ReleaseDate}"/>

thanks.

You want getValueFromIssue() to return the earliest release date for the issue's selected versions not the fix version otherwise your custom field will display the fix version not the earliest release date.

So in getValueFromIssue() get all the issue's selected versions and check each one in turn to see what its release date is, and return the earliest one.

I've already told you how to get the release date for each version: Version.getReleaseDate(). You shouldn't need to mess about creating velocity templates - just use the same ones that the JIRA date custom fields use eg

<resource type="velocity" name="column-view" location="templates/plugins/fields/view/view-datetime.vm"/>
<resource type="velocity" name="xml" location="templates/plugins/fields/xml/xml-date.vm"/>

There is no method in issue object like getVersions() it has only getFixVersions() and getAffectedVersion() methods for version related.

So how to get issue's selected versions.

And also where should i get vm files like view-datetime.vm and xml-date.vm

Please Helpout this. thanks

ComponentManager componentManager = ComponentManager.getInstance();

List<Version> versions = componentManager.getVersionManager().getVersions(issue.getProjectObject().getId());

Iterator it = versions.iterator();

for (inti = 0; i < versions.size(); i++) {if(it.hasNext()){

System.out.println(it.next());

I am getting issue version in to the list then how to get release date from version

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,369 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you