It's all about the answers!

Ask a question

How to be notified about any created work item?

Mateusz Cebula (23914) | asked Apr 04 '14, 4:42 a.m.
I would like to have following setup in my RTC (4.0.4) Project Area:
- automated mail notification for defined set of users when any workitem is created
- automatically add user as a subscriber to every created wokr item.

Do you have any ideas how to achieve it?

Accepted answer

permanent link
Brian Fleming (1.6k11928) | answered Apr 04 '14, 11:01 a.m.
If you want specific users to be added as subscribers to ALL workitems created in a project area, follow the instructions in this technote (no participant code required):
Mateusz Cebula selected this answer as the correct answer

Mateusz Cebula commented Apr 10 '14, 3:48 a.m.

Thanks! It is working :)

One other answer

permanent link
Susan Hanson (1.6k2192194) | answered Apr 04 '14, 4:50 a.m.
I don't know of anything built-in to RTC, but you can do either using a server-side participant.  We add subscribers(s) to a work item upon creation (of a specific type) based on a role, but you can do a single user as well.  In your participant, you would do something like this:

IWorkItem workingCopy = (IWorkItem) fWorkItemServer.getAuditableCommon().resolveAuditable(workItem, IWorkItem.FULL_PROFILE, monitor).getWorkingCopy();

ISubscriptions subscriptions = workingCopy.getSubscriptions();
for (IContributorHandle subscriberHandle : subscribers) {
IStatus saveStatus = fWorkItemServer.saveWorkItem2(workingCopy, null, null);

where workItem is the work item passed to the participant and subscribers is an IContributorHandle[] containing the IContributorHandle's of the people you want subscribed.

We do it by role, so that we don't have to change code when someone else needs added or someone leaves, like this:
    private IContributorHandle[] findApproversByRole(IWorkItem newState, String roleName, IProgressMonitor monitor) throws TeamRepositoryException {
        fWorkItemServer = getService(IWorkItemServer.class);
        fAuditableCommon = getService(IAuditableCommon.class);
        fProcessServerService = getService(IProcessServerService.class);

        //All of this goes and gets the project area from the work item
        IProcessAreaHandle processAreaHandle = fWorkItemServer.findProcessArea(newState, monitor);
        IProcessArea processArea = (IProcessArea) fAuditableCommon.resolveAuditable(processAreaHandle, ItemProfile.createFullProfile(IProcessArea.ITEM_TYPE), monitor);
        IProjectAreaHandle projectAreaHandle = processArea.getProjectArea();
        IProcessArea projectArea = (IProcessArea) fAuditableCommon.resolveAuditable(projectAreaHandle,ItemProfile.createFullProfile(IProcessArea.ITEM_TYPE), monitor);
        //Get the members of the project area and then get people with the correct role at that process area level.
        IContributorHandle[] members = projectArea.getMembers();
        IContributorHandle[] matchingContributors = fProcessServerService.getContributorsWithRole(members, processArea, new String[] { roleName });
        return matchingContributors;

For emailing, you can again, do the same kind of thing in a server-side participant but instead of doing the addition of the subscribers, you can use the RTC mailService to send an email.


Mateusz Cebula commented Apr 04 '14, 4:55 a.m.

Thanks for the answer, but I have access only to RTC Web UI of my Project Area - I am user and have some admin priviledges to the Project Area, but I have no access to source code/server side or stuff like this. So is there any option to have it done?

sam detweiler commented Apr 04 '14, 6:23 a.m.

no.. there is no way to do this with just administration functions

Your answer

Register or to post your answer.