New functionality "Create issues and subtasks" doesn't work for issue picker fields

Issue #441 resolved
Thorsten Kiefer created an issue

There is a great new postfunction "Create issues and subtasks" in version 2.2.24.

But it doesn't work with issue picker custom fields. We use the plugin TestFLO - Test Management for JIRA for our test management. This plugin provides amongst others a new custom field type issue picker. We implemented a similar function as "Create issues and subtasks" using the ScriptRunner plugin. As I saw the new postfunction in the Workflow Toolbox I thougt to change it from the ScriptRunner function to the Workflow Toolbox. It works in the way that the issue is created and a couple of user fields are set in the "Set fields" section. But it is not possible to set such an issue picker field with the issue key of the current issue. I tried the options "Field in current issue", "Parsed text (basic mode)" and "Parsed text (advanced mode)". But the field isn't set with the issue key of the current issue. So we couldn't use the new postfunction.

Also the condition doesn't work with the issue picker field. The condition is that the issue is only created by the postfunction in the case that no other issue exists with the issue key in the issue picker field. The issue picker field is called Implementation Order/Project to be approved and the condition is {code} count(fieldValue(%{Implementation Order/Project to be approved},issuesFromJQL("issuetype = 'Implementation Project'")) INTERSECT fieldValue(%{Issue key},issuesFromJQL("issuetype = 'Implementation Project'")))=0 {code} I don't know if it is the best way to code the condition but it should work. I created the issue using the postfunctions. Because the field was not set as described before I set it manually. Then I repeated the status transition and another issue has been created.

Comments (11)

  1. Fidel Castro Armario repo owner

    Hi Thorsten,

    The cause of the problem is that custom fields provided by TestFLO - Test Management for JIRA add-on are not currently supported by JIRA Workflow Toolbox.

    I will try to support them in next version of the plugin.

  2. Thorsten Kiefer reporter

    Hi Fidel,

    the issue has now been created successfully.

    But a second one has been created although an issue has been created before and the condition should hinder the creation of the second one.

    Is there an error in my condition: count(fieldValue(%{Implementation Order/Project to be approved},issuesFromJQL("issuetype = 'Implementation Project'")) INTERSECT fieldValue(%{Issue key},issuesFromJQL("issuetype = 'Implementation Project'")))=0 or is there an error in the plugin that the condition still cannot handle the cf types of the TestFLO plugin?

    The idea of the condition is that no issue is created in the case that another issue still exists which is linked via the issue picker cf with the issue for which the status transition is performed.

    Best Regards Thorsten

  3. Fidel Castro Armario repo owner

    Thorsten,

    Try using the following boolean expression:

    %{nnnnn} = null
    

    replacing nnnnn with field code of "Implementation Order/Project to be approved" custom field.

  4. Thorsten Kiefer reporter

    Hi Fidel,

    that will not work because Implementation Order/Project to be approved is not defined for this issue type.

    There are two issue types. The postfunction is integrated in the workflow of the first one and creates the second one. Implementation Order/Project to be approved is defined for the second issue type and is an issue picker cf filled with the issue key of the first one.

    I want to check that no issue of second issue type has been created before with the issue key in issue picker cf Implementation Order/Project to be approved of the first issue type (that have the postfunction). Or in other words: Please don't create an issue a second time for the same issue.

    I found an error in my condition and tried another way but it doesn't work. My current solution looks like this

    fieldValue(%{Implementation Order/Project to be approved},issuesFromJQL("issuetype = 'Production Approval Project/Order'")) none in (fieldValue(%{Issue key},issuesFromJQL("issuetype = 'Implementation Project'")))
    

    The idea is to get a set of all issue keys of the first issue type and to get a set of all issue keys in the issue picker cf of the second issue type. And then I check if an issue key value of the second one is in the set of the issue keys of the first issue type.

    Best Regards Thorsten

  5. Fidel Castro Armario repo owner

    Hi Thorsten,

    The correct boolean expression to implement your idea is:

    %{00015} not in fieldValue(%{nnnnn}, issuesFromJQL("issuetype = 'Production Approval Project/Order'"))
    

    replacing nnnnn with field code of "Implementation Order/Project to be approved" custom field.

    Anyway, the following one is more efficient, since it will not need to create in memory a list with the values of field for all 'Production Approval Project/Order' issues in your JIRA instance:

    count(issuesFromJQL("issuetype = 'Production Approval Project/Order' AND 'Implementation Order/Project to be approved' = " + %{00015})) = 0
    

    note that %{00015} is field code for Issue key.

  6. Thorsten Kiefer reporter

    Hi Fidel,

    thank you very much for your help and fix. No it works.

    Your second recommendation is very similar to my very first try. But I got an error message because of the dynamic issue key parameter (%{00015}). Now I see that I forgot the plus sign before %{00015}.

    Best Regards Thorsten

  7. Fidel Castro Armario repo owner

    BTW, yesterday was released version 2.2.25, implementing support for Enhanced Issue Picker custom fields.

  8. Log in to comment