Create subtasks for each user in project role

Issue #787 resolved
Karo Salminen created an issue

Could you advise me how to create a subtask for each user in a project role? Thank you very much.

The subtasks will be assigned depending on the value in custom field. I've done this previously in subtask's own workflow in create transition, but it would be great also to assign the to-be-created subtask with the same post-function.

Comments (10)

  1. Fidel Castro Armario repo owner

    Hi @karosalminen,

    In order to create a sub-task for each user in a project role you should use "Create issues and subtasks" post-function with the following configuration:

    Captura de pantalla 2017-09-07 a las 20.53.33.png

    Seed string expression is: usersInRole("Testers"), considering that you want to create a sub-task for each user in project role Testers.

  2. Fidel Castro Armario repo owner

    Hi @karosalminen,

    In order to assign each new sub-task to a user depending on the value of a field you should use "Create issues and subtasks" post-function with the following configuration:

    Captura de pantalla 2017-09-07 a las 21.17.55.png

    String expression for setting assignee is:

    getMatchingValue(%{nnnnn}, ["value_1", "value_2", "value_3"], ["user_1", "user_2", "user_3"]) 
    

    replacing nnnnn with field code for "My Dependency Field", which is the field used in this example for setting the dependency for assigning issues.

  3. Karo Salminen Account Deactivated reporter

    Many thanks! Can you tell me why I'm getting an error for trying to use rolesUserPlays function in post-function "Create issues and subtasks".rolesUserPlays.jpeg

  4. Fidel Castro Armario repo owner

    You should use function toString() in order to convert a string list into a string. Use the following expression:

    "Sub-task for role: " + toString(rolesUserPlays(^%))
    
  5. Karo Salminen Account Deactivated reporter

    I have one modification for the original question. I would like to create a subtask for each member in project role. The role is the same as value of a custom field. For example, there's a role for each function (e.g. reception) and a custom field for function (which value can be e.g. reception).

    Let's say two members exist for role "Reception" and I would like to assign a sub-task for each of them. There's a value "Reception" in a custom field called "Function".

    So an an issue would be created per seed string returned by the following string list expression: usersInRole(%{10401}). But how should I assign the sub-task for each member? So far I have only assigned all sub-tasks for the first member in the role: assign.jpeg

  6. Fidel Castro Armario repo owner

    As seed string contains a username per each user in selected project role, you simply have to use the following configuration: Captura de pantalla 2017-09-13 a las 0.23.17.png

  7. Log in to comment