Susan Hanson (
1.6k●2●201●194)
| 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) {
subscriptions.add(subscriberHandle);
}
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.
Susan