Send a custom email on evenement
Hello,
I use RTC.4.0.3 and I have created a custom email template. No problem, my custom emails are sent to owner or creator when the workitem state is changed.
First problem : when I create a workitem without assigning a owner, no email is sent whereas I would like that a email is sent to the creator
Next problem : I would like to notify some people when a workitem is created without adding all people on subscribers.
I have found this link (https://jazz.net/jazz/web/projects/Jazz%20Collaborative%20ALM#action=com.ibm.team.workitem.viewWorkItem&id=216962%C2%A0) and so I think that my problems are not supported by RTC.
But I think that I can resolve my problem with JAVA API and send an email when I clic on "save".
OK, so I have tried to load my email custom template (saved in my project) with a java code on the event "com.ibm.team.workitem.operation.workItemSave". I have tried it :
Have you got an idea to load this email template ?
Then, have you got an idea to send an email with JAVA API ? Are there mail library already included on the SDK ?
Thanks for your help.
Regards
Mathieu
I use RTC.4.0.3 and I have created a custom email template. No problem, my custom emails are sent to owner or creator when the workitem state is changed.
First problem : when I create a workitem without assigning a owner, no email is sent whereas I would like that a email is sent to the creator
Next problem : I would like to notify some people when a workitem is created without adding all people on subscribers.
I have found this link (https://jazz.net/jazz/web/projects/Jazz%20Collaborative%20ALM#action=com.ibm.team.workitem.viewWorkItem&id=216962%C2%A0) and so I think that my problems are not supported by RTC.
But I think that I can resolve my problem with JAVA API and send an email when I clic on "save".
OK, so I have tried to load my email custom template (saved in my project) with a java code on the event "com.ibm.team.workitem.operation.workItemSave". I have tried it :
IProjectAreaHandle iProjectAreaHandle = newWorkItem.getProjectArea() ;The email template is not included on my list or list2 ...
IProjectArea iProjectArea = (IProjectArea) auditableCommon.resolveAuditable(iProjectAreaHandle, ItemProfile.createFullProfile(IProjectArea.ITEM_TYPE), monitor) ;
Map<String, IContent> map = iProjectArea.getProcessData();
Collection<IContent> list = map.values() ;
IProcessDefinitionHandle iProcessDefinitionHandle = iProjectArea.getProcessDefinition() ;
IProcessDefinition iProcessDefinition = (IProcessDefinition) auditableCommon.resolveAuditable(iProcessDefinitionHandle, ItemProfile.createFullProfile(IProcessDefinition.ITEM_TYPE), monitor) ;
Map<String, IContent> map2 = iProcessDefinition.getProcessData() ;
Collection<IContent> list2 = map2.values() ;
Have you got an idea to load this email template ?
Then, have you got an idea to send an email with JAVA API ? Are there mail library already included on the SDK ?
Thanks for your help.
Regards
Mathieu
One answer
IProcessArea processArea= (IProcessArea)getService(IRepositoryItemService.class).fetchItem(projectArea, IRepositoryItemService.COMPLETE);
IServerProcess serverProcess= getService(IProcessServerService.class).getServerProcess(processArea);
IProcessConfigurationData data= serverProcess.getProjectConfigurationData("com.ibm.team.workitem.configuration.emailTemplates");
Above lines of code will get you the templates, but is there a reason why you are trying to read the templates??