What needs to be fixed with this custom alert template?

TheVillageIdiot
  • What needs to be fixed with this custom alert template? TheVillageIdiot

    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:

    1. The subject contains all the values irrespective of the type of event (1,2,4) there was no <Switch> statement after <Subject>

    2. 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?

  • Is the added message repeated three times in one template, or are you getting three seperate templates created? Perhaps you have more than one item in your Announcement list that is calling the new template multiple times.

Tags
2007 alert custom-alert-templates
Related questions and answers
  • contains a hyperlink. My CAML render pattern looks like: &lt;RenderPattern Name="DisplayPattern"&gt; &lt;Switch> &lt;Expr> &lt;Column /&gt; &lt;/Expr> &lt;Case Value="" /&gt; &lt;Default> &lt;HTML>&lt;![CDATA[&lt;a href=']]&gt;&lt;/HTML> &lt;Column SubColumnNumber="1" HTMLEncode="TRUE" /&gt; &lt;HTML>&lt;![CDATA['&gt;]]&gt;&lt;/HTML> &lt;Column SubColumnNumber="1" HTMLEncode="TRUE" /&gt; &lt;HTML>&lt;![CDATA[&lt;/a>;]]&gt;&lt;/HTML> &lt;/Default> &lt;/Switch> &lt

  • ;xsl:call-template name="dvt_1.body"&gt; &lt;xsl:with-param name="Rows" select="$Rows"/&gt; &lt;xsl:with-param name="FirstRow" select="1" /&gt; &lt;xsl..._ignore="1"&gt; &lt;xsl:call-template name="dvt_1.rowedit"&gt; &lt;xsl:with-param name="Pos" select="concat('_', position())" /&gt; &lt...; &lt;xsl:call-template name="dvt_1.formactions" /&gt; &lt;xsl:if test="$FirstRow &gt; 1 or $dvt_nextpagedata"&gt;&lt;/xsl:if> &lt;/tr> &lt

  • ' /&gt; &lt;Value Type='Lookup'&gt;1&lt;/Value> &lt;/Eq> &lt;/Where> &lt;/Query> The problem is that this SPQuery returns results only for the first 13 lookup columns. If I put in the FieldRef the internal name for lookup column no 14 or above, it is not working anymore. Why? If I don't use LookupId='TRUE' and do this: (use the value of the lookup and not the id) &lt;Query> &lt;Where> &lt;Eq> &lt;FieldRef Name='Relaterat_x0020_till_x0020_avtal' /&gt; &lt;Value Type='Lookup'&gt;Test avtal</Value>

  • ="{CE8F7528-E643-4473-94E0-BAA57BD2F6E6}" Name="TeamName" StaticName="TeamName" DisplayName="Team Name" Type="Text"&gt; &lt;/Field> &lt;Field ID="{E508D1FA-D3A5-4e91-828B-3BFB43D4F7C5}" Name="WithdrawalComments" StaticName="WithdrawalComments" DisplayName="Withdrawal Comments" Type="Note"&gt; &lt;/Field> &lt;/Fields> It's also been added to the ViewFields in the two default views...I've encountered the strangest problem. I've got two features: ContentTypes: contains a couple of custom fields and a content type (based on plain ol' 0x01) called Withdrawals that uses them

  • In a custom list there is a column / field defined as “Name (with presence)”. In my modified aspx page, I want to do an ‘xsl if’ statement to check if the value from this field is the same as the current user. &lt;xsl:if test="@MyField = $UserID"&gt; ... code here ... &lt;/xsl:if> But the compare fails because the content from the MyField is something like : &lt;span> &lt;A HREF="/sites/121579/MySite/_layouts/userdisp.aspx?ID=452"&gt;***, Stef</A>; &lt;img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/&gt; &lt;a href

  • I can create a CQWP for the Announcement content type, but when I export the .webpart and add &lt;property name="CommonViewFields" type="string"&gt;Expires,Date;Body,text</property> In my ItemStyles.xsl I have added this to show all the returned fields &lt;xsl:template name="ShowXML" match="Row[@Style='ShowXML']" mode="itemstyle"&gt; &lt;xsl:for-each select="@*"&gt; &lt;br /&gt; Name: &lt;xsl:value-of select="name()" /&gt; &lt;br /&gt;Value:&lt;xsl:value-of select="." disable-output-escaping="yes"/&gt; &lt;/xsl:for-each> &lt;/xsl:template>

  • ;V1_I1_CP2;;T_sdja_%252F%252F0%252F%252F [4,["\n \n sdja",["\n \n sdja","","",-1],[true,[["sdja","",0,"",0,[["John Doe","CONTOSO\\sdja",1,"John Doe",""]]]],true],false,false,false],-1,false,false... (ContactPicker.OnEditBoxMouseDown(this, event));" maxHeight="60"&gt;&lt;SPAN class=recipientResolvedUser tabIndex=-1 contentEditable=false ownerid="V1_I1_CP2" displayname="John Doe" objectid="CONTOSO\sdja" objecttype="1" realname="Djaarbekov Stanislav M." orgindex="0"&gt;&lt;SPAN tabIndex=-1 contentEditable=true>Doe 

  • ; &lt;FieldRef Name="ID" /&gt; &lt;!-- Field which do not return values --&gt; &lt;FieldRef Name="Responsible" Nullable="TRUE" Type="UserMulti" /&gt; &lt;FieldRef Name="Accountable" Nullable="TRUE" Type="UserMulti" /&gt; &lt;!-- // Field which do not return values --&gt; &lt;ProjectProperty Name="Title" /&gt; &lt;/ViewFields> &lt;/View> &lt;Query>... Nullable="TRUE" and Type="UserMulti". This works, in the query now returns the correct number of records, however the value in my 2 multi user fields is empty. &lt;View> &lt;Webs Scope="Recursive

  • =\"http://schemas.microsoft.com/WebPart/v2\"&gt; &lt;Title>Content Editor</Title> &lt;FrameType>Default</FrameType> &lt;Description>Allows authors to enter rich text content.&lt...;Microsoft.SharePoint.WebPartPages.ContentEditorWebPart&lt;/TypeName> &lt;ContentLink xmlns=\"http://schemas.microsoft.com/WebPart/v2/ContentEditor\" /&gt; &lt;Content xmlns=\"http://schemas.microsoft.com...\"?&gt;" + "&lt;webParts>&lt;webPart xmlns=\"http://schemas.microsoft.com/WebPart/v3\"&gt;" + "&lt;metaData>" + "&lt;type name

Data information