Execution condition to check if projects with certain keys exist

Issue #808 resolved
Philipp Sendek created an issue

Hi Support,

as Fidel suggested I would like to get in touch with you on a current challenge I’m facing with a Post Function in JWT.

The use case is, that the post function should create 1-or-multiple issues in (different) projects based on the component(s) that have been selected. Therefor I’ve planned to add the project key in the component as “Some Text (Project: KEY)”. In the post-function I use regexp to extract the KEY of the specific project from the components that are added to the source issue.

The post function looks as follows: IMG_0041.JPG

What I’m challenged with is the execution condition. I would like to add a condition that checks whether the project keys belong to valid projects. I’ve been trying to use “project = something” but get the error that an unexpected space has been found after project. Using issuesFromJQL() didn’t work either.

I was wondering whether you have an idea how to define the condition.

Thank you very much in advance, I appreciate your support!

Regards, Philipp Sendek

Comments (5)

  1. Fidel Castro Armario repo owner

    Hi @psendek-brainbits,

    Use the following string list expression for generating the seed strings:

    filterByPredicate(textOnStringList(toStringList(%{00094}), replaceAll(^%, "(.+Project:\\s*)|(\\s*\\)\\s*)", "")), count(issuesFromJQL("project = " + ^%)) > 0)
    

    where %{00094} is field code for Components.

  2. Philipp Sendek reporter

    Hi Fidel,

    thank you for your impressive swift reply! Unfortunately this string as the execution condition triggers a syntax error:

    Screen Shot 2017-09-25 at 08.40.24.png

    Trying to execute it anyway with component ("Personalmanagement (Project: ITEX)" where a project with key "ITEX" does exist) also threw an error: Screen Shot 2017-09-25 at 08.45.32.png Screen Shot 2017-09-25 at 08.45.45.png

    If I can provide any more information, please let me know.

    Regards, Philipp

  3. Fidel Castro Armario repo owner

    Hi @psendek-brainbits,

    The expression I provided is intended to be used for generating seed string for multiple issue creation. Look at the screenshot: Captura de pantalla 2017-09-25 a las 9.47.12.png

    Parameter Conditional execution expects a boolean expression (i.e., an expression that returns true or false), while the expression for seed strings returns a string list. That's the reason of the syntax error.

  4. Philipp Sendek reporter

    Hi Fidel,

    sorry, now I see the brilliance of this adjustment, thank you very much! :-) This of course doesn't require a separate execution condition.

    Again thanks for your very fast and excellent support!

    Regards, Philipp

  5. Log in to comment