It's all about the answers!

Ask a question

send out email notification when work item get assigned to particular category

vivek chaudhari (1346) | asked Oct 03 '12, 2:49 p.m.
 Hi All,

I am creating a server side plugin which will send out email notification to team when a defect gets assigned to particular category.

For example, If i create a workitem and assign category to "IBM" then It will send out email to all members of team from IBM team.

Here is so far code,

public class BuildOnStateChangeParticipant extends AbstractService implements
IOperationParticipant {

public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
Object data = operation.getOperationData();
ISaveParameter saveParameter = null;
if (data instanceof ISaveParameter) {
saveParameter = (ISaveParameter) data;
* If It's a new defect and category = "BUE" then send out emails
String categoryName = "BUE";
String newDefectState = "1";
boolean sendEmail = false;
IWorkItem newState = (IWorkItem) saveParameter.getNewState();
IWorkItem oldState = (IWorkItem) saveParameter.getOldState();
Identifier<IState> newStateId = newState.getState2();
//To get category name
IWorkItemServer workItemServer = getService(IWorkItemServer.class);
String newCategory = workItemServer.resolveHierarchicalName(newState.getCategory(), monitor);
if(oldState == null && newStateId.getStringIdentifier().equals(newDefectState) && newCategory.equals(categoryName))
sendEmail = true;
else if(oldState != null)
String oldCategory = workItemServer.resolveHierarchicalName(oldState.getCategory(), monitor);
if(!oldCategory.equals(newCategory) && newCategory.equals(categoryName))
sendEmail = true;
//Send Email work
System.out.println("Send email out please: " + sendEmail);
//ITeamArea teamArea = getService(ITeamArea.class);   <-- Give exception when i save


So basically can anyone show me how to get list of members and their email id from "BUE" team? basically what class would you use to get list of members? Please.. it would be great help.. Thanks in advance.

One answer

permanent link
Lauren Hayward Schaefer (3.3k11727) | answered Oct 08 '12, 7:12 a.m.
Hi Vivek,
The forum post will hopefully get you started.

Your answer

Register or to post your answer.