last user in project role who has had the issue assigned in the past

Issue #195 resolved
FatimaM created an issue

Hello.We have user A which is in Project role Change Manager and Account Manager.According to our workflow after opening issue there is transition Confirmation CM in which the screen Assignee opens and user B is selected.User B is the member of Change Manager project Role.After It estimation transition comes in which with help of post fucntion Assignee is Default Member of Project Role Account Manager- this is user A.After Return to Confirmation CM transition comes in which with this post function we choose last assignee in project role Change Manager.By idea this should be user B.But post function shows user A.beacuse he is in both roles.Pls advice how could we achieve that in this transition user B will be as Assignee.

Comments (14)

  1. Fidel Castro Armario repo owner

    You can do the following:

    1) Create a "User Picker" custom field called "CM Confirmer" . Don't add this custom field to any screen, since it's intended for workflow internal use.

    2) Add transition "IT Estimation" post-function "Copy a parsed text to a field" with the following configuration:

    conf-1.png

    Note that %{00020} is field code for "Current user".

    3) Add transition "Return to Confirmation CM" post-function "Copy a parsed text to a field" with the following configuration:

    conf-2.png

    Note that %{11800} is field code for "CM Confirmer" in my particular JIRA instance. You should user field code injector to insert the correct field code in your case.

    Additionally, I will study whether I can enrich post-function "Assign to Project Role" in a future version of the plugin, in order to make it able to cope with your use case.

  2. FatimaM reporter

    We have approximately 20 steps with this post function last assignee.In all these cases we should use Copy a parsed text to a field?

  3. Fidel Castro Armario repo owner

    With current version of the plugin that is the safest way to do it. You can save post-function "Copy a parsed text to a field" at transition "IT Estimation" using "Copy a parsed text to a field" at transition "Return to Confirmation CM" wit the following configuration:

    conf-2.png

    Text to be parsed is:

    previousValue(%{00003})
    

    Note that %{00003} is field code for "Assignee".

    The only problem you might have with this alternative solution is that, if you assign issue in transition "Return to Confirmation CM" to the same user it has issue assigned in status "Confirmation CM", expression previousValue(%{00003}) will return the previous user different from current assignee.

    Anyway, I think that you will always assign issue to a different user in transition "Return to Confirmation CM".

  4. FatimaM reporter

    Hello.We have permission Edit Issue and Assign Issue for all users.That is why between transitions user can make Assignee issue.That is why in all steps and transitions we should save the last value for Assignee in user picker field also having 7 roles for this worklflow(25 steps with 4 transitions in each step).So in general we should create 7 fields and each time on transitions to save them.

  5. Fidel Castro Armario repo owner

    Hi Fatima,

    I was thing of a new option like "last user in project role different from current assignee", but since your users can assign issues freely at any moment, it will not work for you.

    I think that you need something like: "last user that executed transition X". Am I right?

    Fidel

  6. FatimaM reporter

    No you know if last user from project role will work poperly I mean like case user A in project role Z and Y and user B is only in Z.If between transitions first was choosed user B as project role Z then user A like project role Y and then goes post function last user in role Z the user A will be but it is incorrect should be user B

  7. Fidel Castro Armario repo owner

    I don't find a modification of the post-function that will be able to cope with such a particular scenario that you describe. Anyway, I keep thinking that a much more general solution, and useful for more users of the plugin will be something like: "Last user that executed a certain transition".

    In your case, would be "Set issue to last user that executed transition 'IT Estimation'".

    Does a post-function like the one I described solve your problem?

  8. Fidel Castro Armario repo owner

    I think I will be able to implement a post-function like that, but I will need some time to do it.

    I think it might be available in version 2.2.3. I will send you a beta version as soon as possible.

  9. Fidel Castro Armario repo owner

    Hi Fatima,

    I have implemented function "usersWhoTransitioned()" in version 2.2.7_beta_1 that makes it possible to implement your use case.

    In order to implement "Set issue to last user that executed transition 'IT Estimation'" you have to use post-function "Copy a parsed text to a field" with the following configuration:

    conf-0.png

    Parameter Text to be parsed is:

    count(usersWhoTransitioned("Confirmation CM", "IT Estimation")) > 0 ? last(usersWhoTransitioned("Confirmation CM", "IT Estimation")) : "" 
    
  10. Log in to comment