Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
please somebody with sufficient points added custom-alerts or custom-alert-templates tags –  TheVillageIdiot Mar 27 '10 at 10:16
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.