I've customized alert notification template for Announcements list. Here is custom code:
<Immediate>
<Subject>
<Switch>
<Expr>
<GetVar Name="EventType" />
</Expr>
<Case Value = "1">
<HTML>New Content on Latest Events</HTML>
</Case>
<Case Value = "2">
<HTML>Modified Content on Latest Events</HTML>
</Case>
<Case Value = "4">
<HTML>Deleted Content on Latest Events</HTML>
</Case>
<Default>
<GetVar Name="AlertTitle" />
<HTML><![CDATA[ - ]]></HTML><GetVar Name="ItemName" />
</Default>
</Switch>
</Subject>
<Fields>
<Switch>
<Expr>
<GetVar Name="EventType" />
</Expr>
<Case Value = "1">
<HTML>
<![CDATA[A new content has been added to Latest Events.
To view, please visit: <a href="]]>
</HTML>
<GetVar Name="ItemUrl" URLEncodeAsURL="TRUE" />
<HTML><![CDATA[">]]></HTML>
<GetVar Name = "ItemName" />
<HTML><![CDATA[</a><br/>Thank You<br/>]]></HTML>
</Case>
<Case Value = "2">
<HTML>
<![CDATA[A content has been modified in Latest Events.
To view, please visit: <a href="]]>
</HTML>
<GetVar Name="ItemUrl" URLEncodeAsURL="TRUE" />
<HTML><![CDATA[">]]></HTML>
<GetVar Name="ItemName" />
<HTML><![CDATA[</a><br/>Thank You<br/>]]></HTML>
</Case>
<Case Value="4">
<HTML>
<![CDATA[A content has been removed from Latest Events.
<br/>Thank You]]>
</HTML>
</Case>
<Default>
<GetVar Name="DisplayName#{Field}" HTMLEncode="TRUE" />
<HTML><![CDATA[ : ]]></HTML>
<GetVar Name="NewValue#{Field}" />
</Default>
</Switch>
</Fields>
<Footer>
<HTML><![CDATA[<br/><hr/>]]></HTML>
$ResourcesNoEncode:Alerts_event_lastmodified;
</Footer>
</Immediate>
The problems I'm facing are following:
The subject contains all the values irrespective of the type of event (1,2,4)there was no<Switch>statement after<Subject>The Item Added message is (in Fields -> Switch -> Case Value="1") is repeated thrice
Is something wrong with above template that is prompting SharePoint to behave wrongly or do I need to do some more work?
custom-alertsorcustom-alert-templatestags – TheVillageIdiot Mar 27 '10 at 10:16