Is there any way I can customize RTC Build email notifications ?
2 answers
There is no out-of-the-box way of adding custom text content to the regular build notification emails.
If this is really needed, you can write your own server side plugins or client(build side) contributions to achieve this.
Ex: You can write a plugin that can be registered with your server that will run an async task periodically to scan for completed builds and send the relevant emails out (yes there will be two emails per build, but perhaps better than nothing to get custom emails). This is how the out-of-the-box build email notifications are sent. If this class is visible in the EWM server SDK, see the implementation for com.ibm.team.build.internal.service.notification.BuildNotificationTask. This is essentially a class that extends com.ibm.team.repository.service.async.AbstractAutoScheduledTask, and queries for particular ChangeEvents which represent completed builds.
ex:
ChangeEventQueryModel model = ChangeEventQueryModel.ROOT;
IItemQuery query = IItemQuery.FACTORY.newInstance(model);
// we want all build changes between a certain date a time, and only those that were originally IN_PROGRESS
query.filter(model.modified()._gtOrEq(query.newDateTimeArg())._and(model.modified()._lt(query.newDateTimeArg()))._and( model.eventCategory()._eq(BuildChangeEvent.BUILD_RESULT_CHANGED_EVENT_CATEGORY))._and(
model.stringExtensions()._eqKeyValue(BuildResultChangeEvent.KEY_OLD_BUILD_STATE,
BuildState.IN_PROGRESS.name())));
You can then use Foundation APIs to send emails using an example like:query.orderByAsc(model.eventTime());
MailSender sender = getMailerService().getDefaultSender();
getMailerService().sendMail(sender, email, subject, content, null);
There are other jazz forum topics that give up to date pointers (to articles/wikis) on how to contribute server side extensions using the public SDK/APIs (I don't have these links handy at the moment, but it should be easy to find if this is the direction you want to persue).
You could also have your build scripts (ex: Ant tasks) send out the appropriate emails, or contribute post-build participants code to a build definition (build public API also supports hooking in custom code for pre/build/post-build callbacks) (however it's probably easier to go with the async serverside task to do this, since this is what is already implemented).
Comments
An example of such an extension: https://rsjazz.wordpress.com/2015/10/16/due-date-notifier-an-asynchronous-task-example/