Import different number of custom fields for the different issue types?

Petya Tsvetanova Petrova February 6, 2013

Hello,

I am looking for a way to create different number of custom fields for the different issue types. For example: can I import 4 custom fields for Bugs and 10 for Tasks?

If this is not possible, can I execute the query from IssueTransformer with all of the fields and then remove some of them?

Petya

2 answers

1 accepted

0 votes
Answer accepted
Pawel Niewiadomski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2013

Nothing stops you from that. For the engine it all matters what's inside ExternalIssue.

So your IssueTransformer may put 4 custom fields for a bug and 10 for an improvement. As long as you know in the IssueTransformer what issue type your dealing with currently.

I'm not sure - are you just asking theoretically or is there any actual problem with this?

Petya Tsvetanova Petrova February 6, 2013

In my case, for each issue type in a project I have different number of custom fields. The query in the IssueTransformer is called only once, so I have to put all of the custom fields there. But then I don't want to have unused field in JIRA and I want to remove these which are not part of the particular issue type. For instance: for Task the project usually has field Efficiency while Bug doesn't use it. I tried a few things, but it didn't work.

Pawel Niewiadomski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2013

Sure, you pull all of them, but then based on the configBean you decide which actually to put into ExternalIssue. At the time IssueTransformer is executed you should have everything (the configuration) in your configBean so you need to make IssueTransformer smarter.

Also you can have your IssueTransformer doing a simple query by default and then for each issue type doing subsequent selects to get the details. As you'll notice we do like that in many places.

Petya Tsvetanova Petrova February 13, 2013

It was very simple solution... I just override the method SetCustomFiledsValues in my IssuesTransformer. There I put a filter over the issue types and everything started working as I wanted it!

Thanks!

0 votes
Petya Tsvetanova Petrova February 6, 2013

In my case, for each issue type in a project I have different number of custom fields. The query in the IssueTransformer is called only once, so I have to put all of the custom fields there. But then I don't want to have unused field in JIRA and I want to remove these which are not part of the particular issue type. I tried a few things, but it didn't work.

Suggest an answer

Log in or Sign up to answer