Sql to find custom fileds

Distef01 August 9, 2017

Hello to all.

How can i find witch sql custom fields assigned to project when only specific issue type selected ?

For example. For any new issues of PRJ1 no custom fields required.

For any new issues of PRJ2 if Task type defined then Filed1 custom filed required otherwise none.

 

 

 

2 answers

0 votes
Distef01 August 9, 2017

Ok thank you very much. I will try and hopefully will work 

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2017

That is not a simple question.  Your SQL will need to read the field contexts, screen schemes and field configurations to work out what might be available on create (and, obviously, the screens could be different for edit.  Oh, and the workflow, you'll need to check workflow screens)

Then for the "fields required" bit, you will have already read the field configuration, but you'll need to check the workflow for any "field is mandatory" conditions or validators.

Are you sure you want to do this with SQL?  As it's the worst possible approach...

Distef01 August 9, 2017

Any suggestions other than SQL ?

Im open minded. :)

Here is my case.

I build an outlook plugin which creates via SDK issues on Jira. 

So far so good.

But for some projects when opening new issue type example BUG a custom field named "Effect" required.

So if user selects this project and this type than i need to ask this extra field value.

 

So i need to know when and what  field required

Thank you in advance for your time  

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2017

Use REST - you'll need to be doing that to create the issues anyway (unless you're emailing the issues to JIRA and using your own mail handler to parse the fields)

See https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues - it shows you how to get a full list of fields and their "required" flag from the project and issue type.

It is a couple of calls, but that's a lot easier to do than building sweeping SQL statements!

Suggest an answer

Log in or Sign up to answer