Post Function - Change Assignee Based on Custom Field Value

Issue #935 resolved
MAG-II created an issue

Hi Fidel -

I have been making lots of progress with JWT, and have been learning a lot. I now have a new question.

In my workflow there is a point where I clone an Issue, which gets created on a different workflow (different Issue type). I then use the JWT Postfunction "Write field on linked Issues" in order to change the Assignee on the newly cloned Issue. That works great.

My question - with this post function, is it possible to update the Assignee (on the cloned Issue) based on a custom field that has already been populated?

When I create the initial Issue there is a drop down custom field where I select the value. Later in the workflow the Issue gets cloned. Can I automatically update the Assignee of the cloned Issue based on what I chose in the drop down custom field?

I'm not sure if the "Write field on linked Issue post function" is able to do that or not.

Comments (9)

  1. Fidel Castro Armario repo owner

    Hi @michaelgayheart,

    Yes, you can do it. To do it you should select "Parsed text (advanced mode)" as value type for source value, and use an expression like the one in the screenshot:

    Captura de pantalla 2017-12-13 a las 23.56.41.png

    The expression in the example is:

    getMatchingValue(%{nnnnn}, ["Red", "Blue", "Green"], ["john.red", "mike.blue", "mary.green", "frank.rainbow"])
    

    replacing nnnnn with the field code of your drop down custom field.

    Note that frank.rainbow is the user to be assigned when the option selected in the drop down field is different from Red, Blue and Green.

  2. MAG-II reporter

    This works great! Thank you! The parsed text (advanced mode) will be very helpful for the future as well. Have a great rest of the week!

  3. MAG-II reporter

    Hi Fidel -

    Referring back to the question of changing the Assignee of an Issue based on a custom field value - is it possible to do this via post function on an Issue itself, and not a linked/cloned Issue?

    Would the "Set a field as a function of other fields" post function be able to achieve this?

  4. MAG-II reporter

    With the "Copy a parsed text to a field" post function I tried using your above example script, but I am getting an error with the terminology. See screenshot -

    Assignee config.PNG

    However I do understand that the (nnnn) value should be the inserted string of the custom field. With that configuration the assignee is not being chosen via the custom field though.

  5. Fidel Castro Armario repo owner

    Hi @michaelgayheart,

    Can use "Copy a parsed text to a field" post-function in advanced parsing mode with an expression like this:

    getMatchingValue(%{nnnnn}, ["Red", "Blue", "Green"], ["john.red", "mike.blue", "mary.green", "frank.rainbow"])
    

    You should replace nnnnn with the field code of the custom field that takes values Red, Blue and Green.

    You can also use "Set a field as a function of other fields" with a configuration like this one:

    Captura de pantalla 2017-12-28 a las 21.19.04.png

    Setting rules in the example are:

    (Red)john.red
    (Blue)mike.blue
    (Green)mary.green
    (.*)frank.rainbow
    
  6. Log in to comment