It's all about the answers!

Ask a question

Category based suscription of user


sreenath v (78167) | asked Jun 25 '20, 4:43 a.m.
Hi,
I have a requirement that i want automatic subscription of a a particular user when i select the categories.

Like
Category A if i select  user1 should get subscribe automatically
category B if i select then user2 should get subscribe automatically

..Is this possible?
I can auto subscribe using default Value set using user list.But i want that suscribe based on category value.

2 answers



permanent link
Davyd Norris (2.2k217) | answered Jun 25 '20, 10:21 p.m.
You can do this by using a script based Default value provider for Subscriptions.

You will need to return an array containing the User ID of the Subscriber(s) you want to add - if this is a static list then you can store them in the project area configuration data and get access to them via the 'configuration' parameter that is passed in to the function. The best way to see what's required is to create a calculated Default value script, populate with the template code, and add

    console.log(workItem.getValue(attribute));

Attach this to your Subscriber field and add a bunch of users, and check the web browser console.

PS: You actually can do all the things in your list above, but you have to be very careful how it's done or else you can introduce performance issues.

Comments
sreenath v commented Jun 25 '20, 10:26 p.m.

Default value i can use userlist instead of script. Again if i change inbuild it will applicable for all workitem which we will no use of requirement.


Davyd Norris commented Jun 25 '20, 10:27 p.m. | edited Jun 25 '20, 10:34 p.m.
But you said you wanted to choose the user based on the category value? You can't do that with a static user list.

When I said if this is a static list, I meant if Category A is always linked to the same user(s), you store an array of objects in your configuration data:

  [{cat: A, users: [id1]}, {cat: B, users: [id2, id3]}]

and then get this array at run time via the configuration parameter, look up the category and return the array associated with it.

Then if the user is ever changed, you just change the config data not the script.

It's also possible to look up the categories, find the teams associated with them, and then look for users with a specific role in those teams, but that requires a lot more complex scripting. A static array in the config data is a really simple approach

Ralph Schoon commented Jun 26 '20, 2:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

A default value does not make sense - the whole concept does not make much sense - as it is only called when the work item is created. At this stage there is almost no information available in the work item. E.g. the category is usually not.


Davyd Norris commented Jun 26 '20, 2:23 a.m.
@Ralph - I have just this situation with a couple of my clients. They want the team lead for the sub team subscribed to all new issues.

When an issue is created they select the Filed Against, and that Category selects the Team Area, and then the scripted Default value adds the appropriate team lead as a  subscriber.

I have also have to create code to add subscribers later in the process but this uses the undocumented API

Ralph Schoon commented Jun 26 '20, 2:45 a.m. | edited Jun 26 '20, 2:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
@Davyd, a default value does not execute after the work item was created. It only executes once, as the work item is created. You talk about a calculated value script. I have mentioned that capability already.

I have seen countless requests on how to better spam the mailboxes of users instead of using capabilities such as the team events or dashboards. This seems to be most popular in Asia.

I think my answer holds. You use a calculated value (JavaScript, Java) or a follow up action (Java). From the documentation, the subscription attribute is not officially supported. You might be able to use it still somehow.

Davyd Norris commented Jun 26 '20, 3:06 a.m. | edited Jun 26 '20, 3:13 a.m.
Correct @Ralph - it executes upon creation. This is exactly what my customers use it for and it works well.

In my comment above, I wasn't saying I have this problem - I was saying I had the same situation and have already solved it.

I also don't think this is a region specific issue, and I find that comment to be vaguely offensive to be honest. What I find is that it's asked for when people do not spend much time in a specific project area and need to be notified of issues affecting their team. With one of my clients, it's because they spend their life in DOORS Next, and are occasionally affected by a requirements change request, so the team lead is notified and subscribed. Another client has a central Change Control Board project  where all issues are reported but they work in their own CCM projects all day.

sreenath v commented Jun 29 '20, 12:38 a.m.
Hi,
Can you provide those steps which can resolve this  problem
showing 5 of 7 show 2 more comments

permanent link
Ralph Schoon (63.1k33646) | answered Jun 25 '20, 10:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I believe that autosubscribe does not make sense. A valid process would be that there is a person looking at the work items incoming for their category on the dashboard and then handles (and maybe changes the category) the incoming work item.

It might be possible to create calculated values that do that https://www.ibm.com/support/knowledgecenter/SSYMRC_7.0.1/com.ibm.team.workitem.doc/topics/c_calc_val_attribute_config.html but I am not sure based on the fact that you always have to return a value. I have not tried that. It is unlikely possible using a JavaScript solution, because the official API https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript does not allow to read the subscriptions using an attribute - at least not officially. Also the fact that a calculated value always must return a value could be problematic.

It would likely be possible to create a Java based calculated value, but that needs to be deployed on the server and the Eclipse clients.

A follow up action could do that in any case, but the effort to write one is considerable.

Comments
sreenath v commented Jun 25 '20, 10:09 a.m.

<section aria-labelledby="d85522e95" class="section" id="c_calc_vals_config__calc-val-limit-sec" role="region">

When you configure calculated value attribute customizations, the following capabilities are not supported:
  • Traversing relationships. For example, calculating all the estimates for the work items under a story and updating the story with the value is not supported.
  • Accessing extended user information such as team membership or roles.
  • Accessing information such as subscriptions or attachments.
Here its telling we cannt do anything with user and subscription.
</section>

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.