add or remove Request Participants as post function

Issue #266 resolved
Yvan Le Texier created an issue

To manage Jira Service desk issue visibility in customer portal, it would be great to have a post function to add or remove users from Request Participants custom field

The logic would be the same than add or remove watchers.

With existing post functions I'm able to :

  • Clear this field
  • add user(s) with overwriting
  • add user(s) with appending
  • add users from group (groovy)

What's missing is removing user from custom fields or group

Maybe a good idea would be to have a "add or remove from user picker custom field" where you can select the destination custom field to update.

Official response

  • Fidel Castro Armario repo owner

    Hi Yvan,

    You can currently do it. To do it you should use "Copy a parsed text to a field" post-function with the following configuration:

    Target field: "Request Participants" Parsing mode: basic** Text to be parsed: depends on the operation

    1) Clear the field: leave "Text to be parsed" parameter empty.

    2) Add user(s) with overwriting: "Text to be parsed" parameter should contain a comma separated list of usernames (don't confuse with user's full name). Example:

    john.williams, david.russell, julian.bream
    

    3) Add user(s) with appending: use prefix + before the comma separated list of user names. Example:

    + john.williams, david.russell, julian.bream
    

    If you use prefix - you will remove the separated users instead of appending.

    If you want to set the field with users in a User Picker or Multi User Picker custom field, simply write the field code, since those kind of fields are rendered as a comma separated list of usernames. Example:

    %{10021}
    

    or

    + %{10021}
    

    4) Add users from group: simply write + group_name . Example: use the following value in "Text to be parsed" parameter for adding all the users in group jira-users to field "Request Participants":

    + jira-users
    

    Versions earlier than 2.2.9 have a bug making it fail when you try to add users to field "Request participants" using prefix + when the field is empty.

Comments (6)

  1. Fidel Castro Armario repo owner

    Hi Yvan,

    You can currently do it. To do it you should use "Copy a parsed text to a field" post-function with the following configuration:

    Target field: "Request Participants" Parsing mode: basic** Text to be parsed: depends on the operation

    1) Clear the field: leave "Text to be parsed" parameter empty.

    2) Add user(s) with overwriting: "Text to be parsed" parameter should contain a comma separated list of usernames (don't confuse with user's full name). Example:

    john.williams, david.russell, julian.bream
    

    3) Add user(s) with appending: use prefix + before the comma separated list of user names. Example:

    + john.williams, david.russell, julian.bream
    

    If you use prefix - you will remove the separated users instead of appending.

    If you want to set the field with users in a User Picker or Multi User Picker custom field, simply write the field code, since those kind of fields are rendered as a comma separated list of usernames. Example:

    %{10021}
    

    or

    + %{10021}
    

    4) Add users from group: simply write + group_name . Example: use the following value in "Text to be parsed" parameter for adding all the users in group jira-users to field "Request Participants":

    + jira-users
    

    Versions earlier than 2.2.9 have a bug making it fail when you try to add users to field "Request participants" using prefix + when the field is empty.

  2. Log in to comment