Hide custom SP List fields on alerts email
HiI've got a custom field and workflow attached to a SharePoint list. I've already modified the default list view so these fields do not show up. However, whenever items are added or modified to this list, an email is generated to users via the "Alert Me" function. This email includes the field and workflow name I want to hide.How do I prevent these from being included in the email?Tks,steven
January 4th, 2010 7:14pm

Hi Steven, Your requirement could be achieved by customizing alerttemplates.xml as Alert Me feature use alerttemplates.xml to render the alert mail. Before following the action plan, please make sure you have read the series of articles: Alerts in Windows SharePoint Services (http://msdn.microsoft.com/en-us/library/bb897925.aspx) Based on my testing, both the old value and new value of the workflow field are empty. And my workaround is to hide the field which old value and new value are empty. This workaround would hide the workflow field as well as other fields meet the condition. 1. Before changing the alerttemplates.xml, your issue should be similar with the following snapshot: 2. Save C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML\alerttemplates.xml as C:\alerttemplates_modified.xml. 3. Edit C:\alerttemplates_modified.xml in Visual Studio or other editor you like. 4. Navigate to the correct AlertTemplate node which matches your list template. See Predefined Alert Templates (http://msdn.microsoft.com/en-us/library/bb802738.aspx) for a full list of alert templates. e.g.: for a Custom List, you should navigate to <AlertTemplate Type="List" Name="SPAlertTemplateType.GenericList"> 5. Navigate to the Format > Immediate > Fields Element if you edit the immediate alert. See Alert Template Format (http://msdn.microsoft.com/en-us/library/bb802961.aspx) for more information about template format. 6. Modify the Fields section, add a condition to remove the fields which old value and new value are empty. I highlighted the code for your information. See IfEqual Element (View) (http://msdn.microsoft.com/en-us/library/ms454493.aspx) for more information. <Fields> <Switch> <Expr><GetVar Name="EventType"/></Expr> <Case Value="2"> <IfEqual> <Expr1><GetVar Name="OldValue#{Field}"/><GetVar Name="OldValue#{Field}"/></Expr1> <Expr2 /> <Then> </Then> <Else> <HTML><![CDATA[ <tr> <td class="formlabel">]]></HTML> <IfEqual> <Expr1><GetVar Name="OldValue#{Field}"/></Expr1> <Expr2><GetVar Name="NewValue#{Field}"/></Expr2> <Then> <GetVar Name="DisplayName#{Field}" HTMLEncode="TRUE" /> <HTML><![CDATA[:</td><td class="formbody"> ]]></HTML> <GetVar Name="NewValue#{Field}" /> <HTML><![CDATA[</td><td class="altvb">&nbsp;</td>]]></HTML> </Then> <Else> <GetVar Name="DisplayName#{Field}" HTMLEncode="TRUE" /> <HTML><![CDATA[:</td><td class="formbody"><span class="edited">]]></HTML> <Limit Len="255" AutoHyperLinkNoEncoding="TRUE" MoreText="..."><GetVar Name="OldValue#{Field}" /></Limit> <HTML><![CDATA[</span> ]]></HTML><GetVar Name="NewValue#{Field}" /> <HTML><![CDATA[</td><td class="altvb"><span class="editedicon">$Resources:Alerts_event_edited;</span></td>]]></HTML> </Else> </IfEqual> </Else> </IfEqual> </Case> <Default> <HTML><![CDATA[ <tr> <td class="formlabel">]]></HTML> <GetVar Name="DisplayName#{Field}" HTMLEncode="TRUE" /> <HTML><![CDATA[:</td> <td class="formbody"> ]]></HTML> <GetVar Name="NewValue#{Field}" /> <HTML><![CDATA[&nbsp;</td> <td class="altvb">&nbsp;</td> </tr>]]></HTML> </Default> </Switch> </Fields> 7. Save the changes to C:\alerttemplates_modified.xml. 8. Run stsadm -o updatealerttemplates -url <site collection url> -filename c:\alerttemplates_modified.xml see Updatealerttemplates: Stsadm operation (Office SharePoint Server) (http://technet.microsoft.com/en-us/library/dd278299.aspx) for more information. 9. Run iisreset command to force the changes to the template list to take effect immediately. 10. The result should be looks like the following snapshot: For your information, you could also modify the Properties Element to hide custom fields, but in my tests, this is not work for the workflow field. See Alert Template Format (http://msdn.microsoft.com/en-us/library/bb802961.aspx) for more information about Properties Element. Hope the information can be helpful. Lambert Qin TechNet Subscriber Support in forum If you have any feedback on our support, please contact mtngfb@microsoft.com Sincerely, Lambert Qin Posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
January 5th, 2010 8:45am

Thanks Lambert. Worked like a charm ;)steven
January 5th, 2010 10:40pm

Hi Lamber, Can you please tell any method so that I may assign alerts based on content type edited in the libarary/list. for example I want to hide some fileds when a document content type is changed in my list but want to show all fields when an infopath form is added to the list. is it possible modify alerts this way? I tried following segment but in vain < <IfEqual> < Expr1> < FieldRef Name="ContentType"/> </ Expr1> <Expr2> <Value> type="string">System Feedback</Value> </Expr2> < Then> <I mmediateNotificationExcludedFields>ID;FeedbackCategory;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;FeedbackSubCategory;AdditionalFeedbackSubCategory;</ImmediateNotificationExcludedFields> < DigestNotificationExcludedFields>ID;FeedbackCategory;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;FeedbackSubCategory;AdditionalFeedbackSubCategory;</DigestNotificationExcludedFields> </ Then> < Else> < ImmediateNotificationExcludedFields>ID;FeedbackCategory;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;</ImmediateNotificationExcludedFields> < DigestNotificationExcludedFields>ID;FeedbackCategory;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;</DigestNotificationExcludedFields> </ Else> </ IfEqual> </ Properties> Properties>
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2010 8:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics