Heya,
This is specifically related to the Checklist for JIRA plugin. The documentation page in question.
I am trying to add a specific checklist based on labels. I've made the workflow so this specific checklist is added only when labels = Draft:
image2016-8-22 15:37:19.png
However, it seems to ignore it and it adds that checklist even when the label is something different:
image2016-8-22 15:39:18.png
I am spawning 5 tasks (same Issue Type) at the same time and I want to add a different checklist to each of them. It seems like the only way to do this is to use Labels so I modified my workflow to add this. However, it doesn't seem to be working as all 5 issues (different Labels) get the same checklist I specified for Draft only. Any ideas / help?
Hi Ovidiu,
Sorry for the delay, I somehow missed the email telling me about the question
First thing that comes to my mind is, and sorry to ask, did you publish the workflow. It happened to me many times
Also, yes, I was planning to eventually add more flexibility to the conditional rules ... even allow adding customfield values.
Yes, the workflow is published.
Let me explain what I'm doing (even behind the curtains):
As you can see below, this is actually the case.
image2016-8-26 11:16:6.png
I've tried a few things:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The are a lot of reasons why I'm setting a custom field (stage) instead of a label on task creation:
Actually to be honest I tried setting a label in the original workflow (when I set the Stage) but I couldn't manage it. Maybe that would fix it? Idk..
I used the code in this ticket and it failed the postfunction with no logs: https://answers.atlassian.com/questions/216834
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea? Sorry to press this but I'd like to give my team an idea if they can expect to have this or try to find a different solution
I should note that I just checked and manually creating the issues and manually adding the Labels on the create screen correctly triggers the post-functions.
It's just that when I create the issue through a Clone & Link issue it doesn't work anymore which really throws a wrench in my plans.
Is it possible to set the Checklist in the Additional Issue Actions when I create each of the 5 Issues? I'd only need to set this once so I wouldn't be against it if you can give me the code needed.
image2016-8-30 13:32:47.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ovidiu,
I am getting really annoyed with Answers! It seems that I don't get notified of some of your postings. For example, when I never received any notification for your answer stating that you did publish the workflow and when I checked manually, your reply was not there.
Anyway, one of the thing that I wanted to ask was to go through the step manually. You did that and it worked. I remember someone trying to do something similar and the post-workflow triggers were never ran when transitioning the issue programmatically. It seems that you have the same issue.
I effectively think that you could create the checklist via Script Runner. I don't know of all the required code (never used script runner) but I can point you to how set the data in. This is a post on answers where I guided a developer on how to change the values of checklist. You can inspire yourself to do the same. Simply pre-create the Checklist field with no values in it. During the transition, add the items programmatically.
https://answers.atlassian.com/questions/39233766
Yves
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the code in that ticket and it worked (to add 1 checklist item). I'm not that tech-inclined to figure out how to add multiple checklist items so I asked Joshi if it's possible to share his solution - hopefully he can answer
Thanks a lot for your time. And if possible to include another rule on adding checklists (such as custom field value) I think that would be a nice feature to have. For now I'll do it programmatically.
Ovidiu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cannot vouch for the code but try something like:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.CustomFieldManager def customFieldManager = ComponentAccessor.getCustomFieldManager(); def cf = customFieldManager.getCustomFieldObjectByName("Pre-Release Task"); def cfConfig = cf.getRelevantConfig(issue) def cfType = cf.getCustomFieldType() def values = [] values << cfType.getSingularObjectFromString('{"name" : "My Checklist Item 1", "checked" : true, "mandatory" : false}') values << cfType.getSingularObjectFromString('{"name" : "My Checklist Item 2", "checked" : true, "mandatory" : false}') values << cfType.getSingularObjectFromString('{"name" : "My Checklist Item 3", "checked" : true, "mandatory" : false}') issue.setCustomFieldValue(cf, values)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That works 99.9%* perfectly, thanks a lot! I guess just one more question to wrap up this workaround: Can you please help me clear the checklist via scriptrunner as well? I assume it's pretty similar except at the end it's:
issue.setCustomFieldValue(cf, null)
Am I correct?
*I have no idea why but the order of the items is off. Even though I have them as 1, 2, 3.. the order in JIRA is 3, 1, 2 which makes no sense. In any case, this is a minor problem which, if consistent, I can work around.
image2016-8-30 15:54:9.png
Edit: if I open the checklist to edit it, they rearrange themselves correctly (3,2,1). Weird but not a big problem:
image2016-8-30 16:2:56.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If
issue.setCustomFieldValue(cf, null)
doesn't work, simply try with an empty array
issue.setCustomFieldValue(cf, [])
As for the order, it probably takes the order in which they were inserted into the array (probably reverse order). So simply change that order to get what you want. If you always recreate the checklist from scratch, you can add the value "rank" to the item such as:
'{"name" : "My Checklist Item 1", "checked" : true, "mandatory" : false, "rank" : 0}'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Null worked, also being able to specify the rank is awesome.
Thanks a lot Yves, I'll mark this as resolved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not quite sure what you want to achieve.
If you are searching for a checklist based on labels you can try Label Manager for JIRA https://marketplace.atlassian.com/plugins/rs.codecentric.label-manager-project/server/overview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anyone? Is this a known issue? Am I doing something wrong?
Any help appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also just as a side-note, it would be really cool if we had more options to Conditional Rules. Labels and Issue Type are really not flexible enough
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.