This topic describes the ChangeRequest.xml configuration file. Your server configuration repository contains a Notifications subfolder containing this and other configuration files.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <notification-config version="1.0"> <rule-list> <rule project="*" event="new" template="cr-new-html"/> <rule project="*" event="modified" template="cr-modified-html"/> </rule-list> <template-list> <template id="cr-new-html"> <subject>New Change Request #~~ChangeNumber~~</subject> <body content-type="text/html" template-file=".\cr-new.html" /> </template> <template id="cr-modified-html"> <subject>Modified Change Request #~~ChangeNumber~~</subject> <body content-type="text/html" template-file=".\cr-modified.html" /> </template> <template id="cr-new-txt"> <subject>New Change Request #~~ChangeNumber~~</subject> <body content-type="text/plain" template-file=".\cr-new.txt" /> </template> <template id="cr-modified-txt"> <subject>Modified Change Request #~~ChangeNumber~~</subject> <body content-type="text/plain" template-file=".\cr-modified.txt" /> </template> </template-list> </notification-config>
When you create or modify a change request, the server searches through the rules defined in the <rule-list> element for the first project attribute that matches the name of the current project that consists of more than the asterisk wildcard character. This allows you to use project=”*” for any projects where you have not created a more specific rule. For example, using the sample code shown above, a project names Project2 would use the text templates and a project named Whitestar would use the HTML templates.
Next, the server searches the matching rule to determine if it applies to the current “new” or “modified” change request. The event attribute of the rule determines this by the values “new” or “modified”. If this value is absent or set to “*”, all change requests use the rule. If the current change request is new, a rule with an event attribute of “new” or “*” must be found.
Once the server finds the correct rule, the template attribute indicates where to look in this .xml file for the subject line to use in the email, the type of template file, and the path to the template file. In the sample ChangeRequest.xml file, if the template attribute in the selected rule was “cr-new-txt” the server uses the following template section to obtain more information:
<template id=”cr-new-txt”> <subject>New Change Request #~~ChangeNumber~~</subject> <body content-type=”text/plain” template-file=”.\cr-new.txt” /> </template>
The subject line of the email reads New Change Request followed by the change request number. The template content type is “text/plain” and the template file is located at “.\cr-new.txt”. You can use the absolute path or a path relative to the Notifications folder for the location of the template file. This example uses a relative path to locate the template file within the Notifications folder.