my jira version is 4.4.1.
i put a validator on "description".and add the validation script below,but the field "description" gets no result.
import com.atlassian.jira.project.version.VersionManager FormField formDescField=getFieldById("description") List<VersionManager> versions=getVersionsReleased(10101,true) as List formDescField.setFormValue(versions.first().getName())
anyone knows how to use the method "getVersionsReleased"
While you’re developing this, you should turn on logging for the Behaviours plugin and check the logs when something goes wrong. In this case, you’d see that your code is throwing exceptions and never even gets to the part where setFormValue is executed.
The problem here is that you can’t just call getVersionsReleased as a bare function. It’s a method of a VersionManager object, but you never got a VersionManager object. You only imported the class, which isn’t enough.
To get the VersionManager object, you can first get the ComponentManager object and call getVersionManager() on it, and to get the ComponentManager object you can import com.atlassian.jira.ComponentManager and call getInstance() on the class. getInstance() is a static function.
(I wish I could point you to some docs on this, but there don’t seem to be any good ones. I had to learn it by puzzling over example code.)
import com.atlassian.jira.ComponentManager import com.atlassian.jira.project.version.VersionManager ComponentManager componentManager = ComponentManager.getInstance() VersionManager versionManager = componentManager.getVersionManager() FormField formDescField=getFieldById("description") List<VersionManager> versions=versionManager.getVersionsReleased(10101,true) as List formDescField.setFormValue(versions.first().getName())
it works using your code.
you say Behaviours Plugin can logging.so i turn on logging for the plugin.
i searched out the JIRA installation location,can only find log files in JIRA\Atlassian\Application Data\JIRA\log.and found three log files:atlassian-jira.log,atlassian-jira-security.log,atlassian-jira-slow-queries.log.
open atlassian-jira.log,i didn't see any error messages about this plugin if i put wrong script into the plugin on purpose.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...
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!
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