Hi,
whenever there is a transition (eg from submitted to assign) I run a script.
In the scrip I am able to get a custom field by doing :
CustomField customField_name = customFieldManager.getCustomFieldObjectByName( "Create Job" );
Where "Create Job" is a custom field I created.
I want to ask how can I check if the field was hidden?
The script I run is not client side but a groovy script on the server.
I know its probably a simple API call but I dont know which one it is.
So if anyone can answer quickly that would be cool :D
Else I will go to the API docs! :D
Thanks
Regards
check the isFieldOnScreen method on following class
Thanks Rambanam.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
don't forgot accept as a answer :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In order not to create new topic i will describe my solution here, besides this topic has been indexed by Google, so maybe it will be useful for someone.
I've just run into same problem, but this solutions wasn't suitable for me. So i started researching JIRA API.
In example above, i should know about 3 params to check whether field on the screen or not.
public boolean isFieldOnScreen(Issue issue, Field field, FieldScreen fieldScreen) { }
But in my case i have only 1 param - Issue, and i don't know what FieldScreen is.
So here is my solution, from Condition class, and it checks Story Points field
public boolean shouldDisplay(ApplicationUser user, JiraHelper jiraHelper) { Map params = jiraHelper.getContextParams(); Issue issue = (Issue)params.get("issue"); boolean isFieldOnScreen = false; CustomField storyPointsField = this.customFieldManager.getCustomFieldObjectByName("Story Points"); /** * Get suitable field screen scheme for existed issue, it will find correct association either * Default - Screen Scheme * or * [Issue Type] - Screen Scheme */ FieldScreenScheme fss = this.issueTypeScreenSchemeManager.getFieldScreenScheme(issue); /** * Iterate over all available operations within scheme * -Create * -Edit * -View */ for (FieldScreenSchemeItem fssi : fss.getFieldScreenSchemeItems()) { //Get field screen for current operation FieldScreen fs = fss.getFieldScreen(fssi.getIssueOperation()); //Iterate over all tabs on screen for (FieldScreenTab fst : fs.getTabs()) { //Check whether tab has field or no if (fst.isContainsField(storyPointsField.getId())) { isFieldOnScreen = true; break; } } } return isFieldOnScreen; }
Check this out.
Also, you can get IssueTypeScreenScheme, for specified project
IssueTypeScreenScheme getIssueTypeScreenScheme(Project project); IssueTypeScreenScheme getIssueTypeScreenScheme(Long id);
And then, get
FieldScreenScheme getEffectiveFieldScreenScheme(IssueType type);
by your issuetype, from issue or check something different on this scheme.
Hope, this'll help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sergey Temchenko, a big thanks for posting this out! Saved me a lot of energy browsing Jira's API and figuring it out by mylself. I was on a tight deadline :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.