SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I working with custom AlertTemplate. I only want to send an Alert if field "Beställare" or "Agent" contains my UserId I Have tried with this query, but I always get an Alert when something chanches.

        <Value type="integer"><UserID /></Value>
        <FieldRef name="Best%5Fx00e4%5Fllare/New"/>
        <Value type="integer"><UserID /></Value>
        <FieldRef name="Agent/New"/>

How will I change by query so I only get alerts for the conditions above?

share|improve this question

Using the <UserID> element like you've done is absolutely right. Compare your CAML to the official MSDN example here -- perhaps try placing your <Value> node below the <FieldRef> nodes as they have done. Everything else looks okay.

Alternatively, any time you create a new alert template you will need to do these three things before your changes will take effect:

  • Load your your custom alert template XML into SharePoint with the updatealerttemplates STSADM command

  • Associate you new alert template with your list as follows:

    SPAlertTemplateCollection alertTemplates = new SPAlertTemplateCollection((SPWebService)(SPContext.Current.Site.WebApplication.Parent)); 
    list.AlertTemplate = alertTemplates["Your Template Name"];
  • Restart IIS (sometimes you may need to restart "SharePoint 2010 Timer" service too)

share|improve this answer
I get the same result when I try to change order and restart the iis ans the service. The other things I have done before. – Daniel Jan 19 '12 at 10:24
If you've followed all the steps above, then the only room for error are the <FieldRef> attributes in your CAML. Try this... 1) query only the "Agent" field (the special characters in your other field name may be causing errors). 2) Remove "/New" from the field name, and 3) add LookupId="True" to the <FieldRef> tag. See the official FieldRef Element definition (make sure you read then comments at the bottom re: the LookupId property) – Nick Larter Jan 20 '12 at 3:01

Your Answer


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.