...
Event List
Page Tree | ||
---|---|---|
|
Making the notification template
If you want to use data from the event in the notification template you will need to write correct XPath to the data.
Example 1: template that just writes event name. notice Xpath EventData/EventInfo/Event
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="EventData/EventInfo/Event"/>
</xsl:template>
</xsl:stylesheet> |
Example 2: template that takes something from event data - let’s say we have event UserTermsAndConditionsAccepted and we want to write TargetSystemName
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="EventData/UserTermsAndConditionsAccepted/TargetSystemName"/>
</xsl:template>
</xsl:stylesheet> |
Notice that in XPath we put the name of the event data contract and then path to the property which was there simply TargetSystemName
Example 3: notification in HTML format and with table inside event data (event data contract is MachineLogonUserNotificationDataContract
)
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Logon Users of the week</h2>
<xsl:value-of select="EventData/EventInfo/EventMessage"/>
<h2><xsl:value-of select="EventData/MachineLogonUserNotificationDataContract/MachineName"/></h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Time</th>
<th>Identifier</th>
<th>Action</th>
</tr>
<xsl:for-each select="EventData/MachineLogonUserNotificationDataContract/LogonUsers/LogonUserHeaderDataContractArray/LogonUserHeaderDataContract">
<tr>
<td><xsl:value-of select="TimeStamp" /></td>
<td><xsl:value-of select="Identifier" /></td>
<td><xsl:value-of select="Action" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet> |
How to do the XPath
As you noticed Xpath start with EventData then you set event data contract and go to the data contract itself of use EventInfo.
EventInfo contains:
Code Block |
---|
{
EventMessage : string
Event : string, //translated event name
Level : string //translated event level
} |
Template Name
In the template name you should specify following parts:
Descrription | |
---|---|
Type (required) | What part of the notification this template is for. Possible values
|
Event | For which event is this template. (prefix '_e') Possible values: id of the event |
Level | For which event level is this template. (prefix '_l'). Possible values (subscription_event_level table):
|
Message type | For which message type is this template. (prefix '_t'). Possible values (subscription_notification_type table):
|
Participating entities | For which entities is this template. (prefix '_p') Possible values: id of the entity Can occur multiple times |
Examples:
MessageBodyHtml_e14_l1_t2 - this is HTML message body for event 14 with level Info and type Email
MessageBodyHtml_e19 - this is HTML message body for event 19 for any level and any type