Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

 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,

SuppressWarnings("restriction")
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.

0 votes



One answer

Permanent link
Hi Vivek,
The forum post https://jazz.net/forum/questions/50908/getting-members-and-roles-programmatically-for-team-area will hopefully get you started.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,943

Question asked: Oct 03 '12, 2:49 p.m.

Question was seen: 3,687 times

Last updated: Oct 08 '12, 7:12 a.m.

Confirmation Cancel Confirm