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

Any idea how to hide/remove those columns that are generated with each workflow on Alert Me emails?

share|improve this question
add comment

2 Answers 2

If you do not need to interact with the column in the GUI, you could hide it. Here is how you can do it in PowerShell:

$web = Get-SPWeb http://site/web
$list = $web.Lists["ListName"]
$field = $list.Fields["FieldName"]
$field.Hidden = $true
$field.Update()
$list.Update()
$web.Update()
share|improve this answer
add comment

Cap..

As described in the answer on similar question asked on Technet Forum

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

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.

  • Before changing the alerttemplates.xml, your issue should be similar with the following snapshot:
    enter image description here

  • Save C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML\alerttemplates.xml as C:\alerttemplates_modified.xml.

  • Edit C:\alerttemplates_modified.xml in Visual Studio or other editor you like.

  • Navigate to the correct AlertTemplate node which matches your list template. See Predefined Alert Templates for a full list of alert templates. e.g.: for a Custom List, you should navigate to

  • Navigate to the Format > Immediate > Fields Element if you edit the immediate alert. See Alert Template Format for more information about template format.

  • 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) 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>
  • Save the changes to C:\alerttemplates_modified.xml.

  • Run stsadm -o updatealerttemplates -url -filename c:\alerttemplates_modified.xml see Updatealerttemplates: Stsadm operation (Office SharePoint Server) for more information.

  • Run iisreset command to force the changes to the template list to take effect immediately.

  • 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 for more information about Properties Element.

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.