<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>SharePoint Magazine &#187; SharePoint Designer</title>
	<atom:link href="http://sharepointmagazine.net/tag/sharepoint-designer/feed" rel="self" type="application/rss+xml" />
	<link>http://sharepointmagazine.net</link>
	<description>SharePoint Magazine is an online Magazine dedicated to the world of SharePoint</description>
	<lastBuildDate>Mon, 05 Jul 2010 09:14:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Developing a Custom Master Page (Master Pages and SharePoint part 3 of 6)</title>
		<link>http://sharepointmagazine.net/technical/customisation/developing-a-custom-master-page-master-pages-and-sharepoint-part-3-of-6</link>
		<comments>http://sharepointmagazine.net/technical/customisation/developing-a-custom-master-page-master-pages-and-sharepoint-part-3-of-6#comments</comments>
		<pubDate>Mon, 06 Oct 2008 10:30:55 +0000</pubDate>
		<dc:creator>ggalipeau</dc:creator>
				<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[designer]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[Master Page]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=749</guid>
		<description><![CDATA[This is the third article in a six-part series on ASP.NET Master Pages and SharePoint. In the previous two articles of this series we discussed master pages and how SharePoint uses them to create it's out of the box pages. Now that we have an understanding of how master pages work and how SharePoint uses them, we can start showing how to develop custom master pages. In this article we are going to concentrate on editing master pages in SharePoint Designer. ]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This is the third article in a six-part series on ASP.NET Master Pages and SharePoint.</p>
<ol>
<li><a href="http://sharepointmagazine.net/technical/development/introduction-to-master-pages">Introduction to Master Pages</a>.</li>
<li><a href="http://sharepointmagazine.net/technical/development/examining-the-out-of-the-box-master-pages-in-sharepoint">Examining the out of the box Master Pages in SharePoint</a>.</li>
<li><strong>Developing a custom Master Page for SharePoint.</strong></li>
<li>Options to deploy a Master Page for a production ready system.</li>
<li>Customizing the Application.master Page.</li>
<li>Incorporating a Master Page into a SharePoint site definition</li>
</ol>
<p>In the previous two articles of this series we discussed master pages and how SharePoint uses them to create it&#8217;s out of the box pages. Now that we have an understanding of how master pages work and how SharePoint uses them, we can start showing how to develop custom master pages.</p>
<p>There are two supported scenarios for customizing master pages in SharePoint:</p>
<ol>
<li>Edit the master page in SharePoint Designer</li>
<li>Create a custom master page and upload it to the master page gallery</li>
</ol>
<p>Please notice that modifying the existing master page file is not one of the supported options. Microsoft rarely supports changing files in SharePoint unless it is done from SharePoint Designer.</p>
<p>In this article we are going to concentrate on the &#8220;Edit the master page in SharePoint Designer&#8221; option. This will show us how to develop a custom master page. In the next article we will learn how to deploy this custom master page for a production ready system.</p>
<h2>UnGhosting (Customizing)</h2>
<p>When a new site in SharePoint is created it uses the default.master for its master page, which is located at %Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Global.</p>
<p><strong>Note</strong>: This is true for WSS team sites and standard MOSS team sites (MOSS publishing sites might use a different master page to start with).</p>
<p>SharePoint keeps a reference to this one file no matter how many sites are created. This is a process called Ghosting, or Uncustomized. Thus, every site collection and/or site in SharePoint point to one file.</p>
<p>If a master page is customized in SharePoint Designer, SharePoint stores a modified version of the master page in the content database (this is a technique called &#8220;Unghosting&#8221; or &#8220;Customizing&#8221;). This process basically breaks the reference SharePoint keeps to the default.master file on the 12 hive. The reason for this is that changes will not affect the other content pages that refer to it.</p>
<p>SharePoint Designer can&#8217;t modify the default.master page in the 12 hive because it would modify a file that multiple site collections and/or sites use. Instead, it goes through the &#8220;UnGhosting&#8221;, or &#8220;Customizing&#8221;, process. This is the process of removing the link to the 12 hive and making a copy of the default.master in the content database.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/ghostedunghosted.jpg"><img class="alignnone size-medium wp-image-750" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/ghostedunghosted-300x108.jpg" alt="" width="300" height="108" /></a></p>
<h2>SharePoint Designer</h2>
<p>SharePoint Designer knows about the SharePoint architecture. Since the SharePoint architecture is a mixture of physical files (on the 12 hive) and content (from the database), a web design tool for SharePoint must know about this architecture. SharePoint Designer is the only tool currently available that knows about this architecture. SharePoint Designer knows how to render the structure of the SharePoint site and how to allow for changes using the UnGhosting, or Customizing, techniques.</p>
<p>To modify a master page in SharePoint Designer first open SharePoint Designer on your SharePoint box. Next open the SharePoint site by going to File &#8211; Open Site. In the Site Name field put the url to the home page of your SharePoint site, without the actual page in it (i.e.: don&#8217;t keep default.aspx in the string).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/opendesignersite.jpg"><img class="alignnone size-medium wp-image-754" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/opendesignersite-300x187.jpg" alt="" width="300" height="187" /></a></p>
<p>After you open a site in SharePoint Designer, Designer will create the folder structure for the SharePoint site:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/designerfolderlist.jpg"><img class="alignnone size-medium wp-image-755" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/designerfolderlist.jpg" alt="" width="202" height="191" /></a></p>
<h2>Create a new master page</h2>
<p>The master page gallery is located in the _catalogs folder. Within the master page gallery you will find the default.master page. You can modify this file directly, but it is good practice to make a copy of this file and modify the copied file. I am going to call this copied master page &#8220;customDefault.master&#8221;.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/designerfolderlistwithmasterpageopen.jpg"><img class="alignnone size-medium wp-image-757" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/designerfolderlistwithmasterpageopen.jpg" alt="" width="204" height="257" /></a></p>
<p>After you make a copy of the master page, the content pages will not know that this is the master page they should use. So, default.aspx is the content page. And if you open default.aspx in SharePoint Designer, you will notice this in the upper right corner:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/defaultpagemasterpagepointer.jpg"><img class="alignnone size-medium wp-image-758" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/defaultpagemasterpagepointer.jpg" alt="" width="212" height="32" /></a></p>
<p>Notice that it is still pointing to the default.master page. If you want it to point to the new customDefault.master page, then right click on customDefault.master (in the Folder List) and choose &#8220;Set as Default Master Page&#8221;. After doing this, open the default.aspx page again and notice that the master page referenced changed:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/designerfolderlistwithcustommasterpageopen.jpg"><img class="alignnone size-medium wp-image-756" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/designerfolderlistwithcustommasterpageopen.jpg" alt="" width="234" height="21" /></a></p>
<p>So, why does this reference pointer change, but the MasterPageFile still points to default.master (MasterPageFile=&#8221;~masterurl/default.master&#8221;). The reason is dynamic tokens. SharePoint replaces &#8220;masterurl/default.master&#8221; with the dynamic token value at run time. The reference pointer we are seeing is that dynamic token. So, when you click &#8220;Set as Default Master Page&#8221; in SharePoint Designer, you are changing the dynamic token for the SharePoint site. For more information on dynamic tokens, refer to the second article in this series &#8211; <a href="http://sharepointmagazine.net/technical/development/examining-the-out-of-the-box-master-pages-in-sharepoint">Examining SharePoint Master Pages</a>.</p>
<h2>Customize the customDefault.master</h2>
<p>Open up the new customDefault.master page. If you are using MOSS, SharePoint Designer might ask you to check it out at this point. If you are in WSS, you shouldn&#8217;t have to check the file out.</p>
<p>SharePoint Designer has three different modes for customization:</p>
<ol>
<li>Design &#8211; WYSIWYG editor</li>
<li>Code &#8211; html editor</li>
<li>Split &#8211; keeps the design and code modes open</li>
</ol>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/splitcodemode.jpg"><img class="alignnone size-medium wp-image-759" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/splitcodemode.jpg" alt="" width="172" height="57" /></a></p>
<p>I prefer to keep SharePoint Designer in split or code mode. The reason is that when you customize a SharePoint master page you have to be careful where you put customizations. If you place a customization in a ContentPlaceHolder, there is a chance the customization won&#8217;t show on the final page because the implementing content page might take care of filling in the particular ContentPlaceHolder. So, if you make changes in design mode, it is beneficial to see what is happening in the html.</p>
<p>So, let&#8217;s make some customizations so you can see some things that can be done.</p>
<h3>Create a footer</h3>
<ol>
<li>Find the tag &lt;/Body&gt; in your code view and put your cursor right before it.</li>
<li>Type the some footer text &#8211; ex: Copywrite RDA all rights reserved 2008.</li>
<li>Wrap the footer text in a div tag.</li>
<li>Set a class to the div tag. For example purposes we can use an out of the box css class from SharePoint</li>
<p>&lt;div class=&#8221;ms-CommentFooter&#8221;&gt;Copywrite RDA all rights reserved 2008&lt;/div&gt;</p>
<li>Save the file.</li>
<p><strong>Note</strong>: SharePoint Designer should give you a popup telling you that you are about to UnGhost, or Customize, your SharePoint master page. This is your warning that you are going to break that reference to the 12 hive and make a separate master page in the content database. Click Yes.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/unghostwarning.jpg"><img class="alignnone size-medium wp-image-761" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/unghostwarning-300x99.jpg" alt="" width="300" height="99" /></a></p>
<li>Optional: if you are in MOSS, you might have to check the file back in at this point. Right click on the customDefault.master in the Folder list and choose &#8220;Check In&#8221;.</li>
<li>Open your site in your web browser to see the change.</li>
</ol>
<h3>Create a new style</h3>
<p>Our footer example uses the out of the box &#8220;ms-CommentFooter&#8221; for our css class. This example will show you how to change that to one of your own custom css classes.</p>
<ol>
<li>Change &#8220;ms-CommentFooter&#8221; to &#8220;custom-footer&#8221; in the code view</li>
<p>&lt;div class=&#8221;custom-footer &#8220;&gt;Copywrite RDA all rights reserved 2008&lt;/div&gt;</p>
<li>Select the &#8220;new style&#8221; link from the Apply Styles toolbar on the right</li>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/applystyles.jpg"><img class="alignnone size-medium wp-image-763" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/applystyles-157x300.jpg" alt="" width="157" height="300" /></a></p>
<li>Set the properties of the style
<ul>
<li>Selector = .custom-footer</li>
<li>Font
<ul>
<li>Font-family = Verdana</li>
<li>Font-size = x-small</li>
<li>Font-style = italic</li>
</ul>
</li>
</ul>
</li>
<li>Click Ok on the style popup</li>
<li>Save the file</li>
<li>Optional: if you are in MOSS, you might have to check the file back in at this point. Right click on the customDefault.master in the Folder list and choose &#8220;Check In&#8221;.</li>
<li>Open your site in a web browser to see the changes</li>
</ol>
<h3>Modify a SharePoint Control</h3>
<ol>
<li>Find the top menu in the code view</li>
<p>&lt;SharePoint:AspMenu<br />
ID=&#8221;TopNavigationMenu&#8221;sdgds<br />
&#8230;</p>
<li>Change the Orientation to Vertical</li>
<p>Orientation=&#8221;Vertical&#8221;</p>
<li>Save the file</li>
<li>Optional: if you are in MOSS, you might have to check the file back in at this point. Right click on the customDefault.master in the Folder list and choose &#8220;Check In&#8221;.</li>
<li>Open your site in a web browser to see the changes. Your menu control should be vertical now.</li>
</ol>
<p><em>(Please not the intent of the above change is to show that the out of the box SharePoint controls can be changed. I understand that the actual change we made is not user friendly).</em></p>
<h3>Modify out of the box css classes</h3>
<ol>
<li>Find the text &#8220;ms-globalbreadcrumb&#8221; in the code.</li>
<li>Right click on it.</li>
<li>Click &#8220;Follow Code Hyperlink&#8221;
<ul>
<li>a. It will take you to one of the sections for this css class</li>
<li>b. The section right above it contains the code for the background color.</li>
<li>c. Change the background color to #000000</li>
</ul>
</li>
<blockquote><p>.ms-globalbreadcrumb{<br />
font-size:8pt;<br />
text-align:right;<br />
background-color:#000000;<br />
padding:2px 10px 2px 5px;<br />
}</p></blockquote>
<li>Save the css file</li>
<p><strong>Note</strong>: SharePoint Designer should give you a popup telling you that you are about to UnGhost, or Customize, your css file. This is your warning that you are going to break that reference to the 12 hive and make a separate css file in the content database. Click Yes.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/unghostwarning.jpg"><img class="alignnone size-medium wp-image-761" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/unghostwarning-300x99.jpg" alt="" width="300" height="99" /></a></p>
<li>Open your site in a web browser to see the changes. The top bar should be black now.</li>
</ol>
<p><em>(Please not the intent of the above change is to show that the out of the box SharePoint controls can be changed. I understand that the actual change we made is not user friendly).</em></p>
<p><em></em></p>
<h2>Be careful with your power</h2>
<p>These are just a few examples of some customizations that can be done to the master page through SharePoint Designer. The customizations you can do are endless. However, you must be careful that you do not customize something that is required for SharePoint to work.</p>
<p>Some examples of controls you don&#8217;t want to remove are:</p>
<ul>
<li>Site Actions</li>
<li>Search (if you want search capabilities)</li>
<li>Navigation menus (unless you want to replace them with your own navigation)</li>
<li>Etc&#8230;</li>
</ul>
<p>Also, be careful where you make your changes. In the previous articles we talked about how making changes to content within ContentPlaceHolders might get overridden by the implementing content page. Thus, if you make a change to a ContentPlaceHolder, you might not see it on your page. My recommendation is to put SharePoint Designer into Split mode or Code mode so you can edit the html directly and you can be sure that you are not editing html within ContentPlaceHolders.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/splitcodemode.jpg"><img class="alignnone size-medium wp-image-759" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/splitcodemode.jpg" alt="" width="172" height="57" /></a></p>
<p>And remember; don&#8217;t remove any of the ContentPlaceHolders. The content pages in SharePoint already have references to these place holders. If you remove them the content pages might break.</p>
<h2>Undo your Customizations</h2>
<p>After making the change notice the default.master in the folder list on the left side. It now has a symbol next to it. If you mouse over that symbol it will tell you that the page has been customized. This is telling you that you have UnGhost, or Customized, this page at one point.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/09/customizedmouseover.jpg"><img class="alignnone size-medium wp-image-767" src="http://sharepointmagazine.net/wp-content/uploads/2008/09/customizedmouseover.jpg" alt="" width="196" height="240" /></a></p>
<p>If you decide that you made a mistake by UnGhosting, or Customizing, your file &#8211; then you can undo your changes by &#8220;re-Ghosting&#8221; the file. To do this, right-click on the default.master file and choose &#8220;Reset to Site Definition&#8221;.</p>
<h2>SharePoint Designer Pros</h2>
<p><strong>Easy</strong> &#8211; SharePoint designer provides an easy experience to customize SharePoint master pages. Any user with html experience should be able to use SharePoint designer to make changes to a master page. As the steps above show &#8211; you can just open your master page up, make your changes and then save your changes in SharePoint Designer.</p>
<p><strong>UI experience</strong> &#8211; SharePoint designer gives you a WYSIWYG (what you see is what you get) UI experience. This means you can make changes to the website through an interface that looks like the website. The other techniques we are going to mention do not allow for this.</p>
<h2>SharePoint Designer Cons</h2>
<p><strong>Unghosting/Customizing</strong> &#8211; the Unghosting, or Customizing, technique keeps all changes scoped to the respective site collection. There is no real way to point the master page to another site collection. This can hurt maintainability if you are creating multiple site collections on one SharePoint box and want to keep a consistent master page.</p>
<p><strong>Not Deployable</strong> &#8211; SharePoint Designer forces you to make changes directly against a SharePoint site collection. This makes it hard to move from a development, to QA, to production environment. This also makes it so the customized master page cannot be used against multiple site collections.</p>
<h2>Conclusion</h2>
<p>SharePoint Designer provides us a quick way to customize master pages in SharePoint. This is a great tool to design master pages and/or customize an existing SharePoint site. However, SharePoint Designer does not provide a clear deployment path for projects using a development lifecycle. The next article in this series will show how to create custom master pages that can be uploaded to any SharePoint site for easy deployments.</p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/customisation/developing-a-custom-master-page-master-pages-and-sharepoint-part-3-of-6/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Use SharePoint Designer to Email Daily Task Reminders</title>
		<link>http://sharepointmagazine.net/technical/development/the-dog-ate-my-task-use-sharepoint-designer-to-email-daily-task-reminders</link>
		<comments>http://sharepointmagazine.net/technical/development/the-dog-ate-my-task-use-sharepoint-designer-to-email-daily-task-reminders#comments</comments>
		<pubDate>Fri, 18 Jul 2008 12:37:19 +0000</pubDate>
		<dc:creator>pagalvin</dc:creator>
				<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=102</guid>
		<description><![CDATA[Use SharePoint Designer to create a workflow solution that sends a daily email reminder  to business users to complete their assigned tasks.]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>It never fails to happen.  Your company invests in SharePoint, takes time to define business processes and automate them using workflow (with a dash of InfoPath, perhaps), tests the solution to within an inch of its life and finally launches in production.  Two days later, it comes to a screeching halt <strong>because the user community isn&#8217;t completing system-assigned tasks</strong>.  Business processes don&#8217;t run to completion, KPIs are flashing amber and red.  Someone has just got around to blaming the problem on global warming &#8230;</p>
<p>Of course, failing to complete tasks won&#8217;t normally cause that much trouble.  It&#8217;s just plain inefficient, even in a simple scenario where a department manager manually creates tasks in a WSS task list.  The manager shouldn&#8217;t have to remember to look at an &#8220;incomplete tasks view&#8221; to find out which department members have overdue tasks.</p>
<p>Users always have plenty of excuses:</p>
<ul>
<li>&#8220;I can&#8217;t find the task.&#8221;</li>
<li>&#8220;I didn&#8217;t know I was assigned a task.&#8221;</li>
<li>&#8220;The dog ate my task.&#8221;</li>
</ul>
<p>This a common business problem and we can solve it.</p>
<p>Companies often turn to so<a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pic1.png"></a>me kind of automated reminder system to prod End Users into marking their tasks complete, thereby allowing those beautifuly orchestrated business processes to proceed as designed.  This article describes how &#8220;Power&#8221; End Users and Developers alike can use SharePoint Designer to create an automated task reminder system based on SharePoint&#8217;s core workflow capability.  This solution applies equally well to Windows SharePoint Services 3.0 (WSS) and Microsoft Office SharePoint Server (MOSS).  The article starts off with a little theory and then moves into a painstakingly detailed and lovingly created walk-through describing exactly how to create this workflow solution.   After the walk-through, it describes some important limitations, some technical implications and finally, suggests some useful extensions.</p>
<p>First, the business requirement:</p>
<ul>
<li>A task has been assigned to a user.</li>
<li>The system should send an email to the user every 24 hours until the user has completed the task.</li>
</ul>
<p>It doesn&#8217;t get much more straight-forward than that.</p>
<p>We will use SharePoint Designer to create a workflow solution that meets that requirement.  The solution leverages several SharePoint features:</p>
<ul>
<li>Windows Workflow Foundation.</li>
<li>SharePoint Designer (of course).</li>
<li>SharePoint workflow&#8217;s remorseless nature.</li>
</ul>
<p>&#8220;Remorseless nature&#8221; means that a functioning SharePoint environment continues running a given workflow <em>forever</em> unless one of two things happens:</p>
<ol>
<li>The task is deleted.</li>
<li>The workflow decides on its own to quit.</li>
</ol>
<p>Before we fire up SharePoint Designer, we need to consider the workflow&#8217;s design:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg15-worfklow-diagram.png"><img class="alignnone size-full wp-image-134" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg15-worfklow-diagram.png" alt="" width="357" height="482" /></a></p>
<p>This looping workflow has one choice to make among three options each time iterates:</p>
<ol>
<li>Is the task complete? If yes, quit. Yeah, we&#8217;re done!</li>
<li>Is this the first time I&#8217;m sending a reminder? If yes, send a reminder and pause one day. Set a flag to indicate that the first reminder has been sent.</li>
<li>Is the second or more time I&#8217;m sending a reminder? If yes, send it and pause one day. Increment a counter to indicate how many reminders have been sent.</li>
</ol>
<p>(Developer readers here may be thinking to themselves that these seem a lot like states and/or state transitions.  You&#8217;d be correct to think that.)</p>
<p><strong>Pre-Configuration</strong></p>
<p>To support a design like this, we need to add two columns to our task:</p>
<ol>
<li>FirstEmailReminderSent</li>
<li>EmailReminderCount</li>
</ol>
<p>The workflow uses these fields to maintain some information about the task (e.g. was an email reminder sent) as well as to trigger the workflow to run again for subsequent reminders.</p>
<p>These two columns, added via the task list&#8217;s settings, look like this:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pic13.png"><img class="alignnone size-full wp-image-108" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pic13.png" alt="FirstEmailReminderSent" width="500" height="543" /></a><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pic12.png"></a><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg_1_1.jpg"></a></p>
<p>It&#8217;s important to set the default value of FirstEmailReminderSent to &#8220;No&#8221;.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pic2.png"><img class="alignnone size-full wp-image-107" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pic2.png" alt="EmailReminderCount task column." width="500" height="419" /></a></p>
<p>EmailReminderCount is simply an number with default value of zero.</p>
<p><strong>Walk-through</strong></p>
<p>With this configuration work complete, let&#8217;s see all of this in action by creating a workflow.  Firing up SharePoint Designer, we create the workflow in the normal way (i.e. open up the site with the task list, create new SharePoint content, create a workflow).  It looks like this:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg03-create-workflow.png"></a><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg03-create-workflow.png"><img class="alignnone size-full wp-image-110" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg03-create-workflow.png" alt="Creating a new workflow.  Make sure it\'s set to run on Create and Update." width="500" height="389" /></a></p>
<p>The workflow has been named &#8220;Daily Reminder,&#8221; it&#8217;s associated with a list called &#8220;Tasks&#8221; (i.e. the task list) and here is the key: It&#8217;s set to run both when the task is created <em>and</em> when it&#8217;s changed.  The &#8220;whenever an item is changed&#8221; bit is very important, as we&#8217;ll see later.  This setting enable us to leverage SharePoint&#8217;s remorseless nature to our benefit.</p>
<p>The first step of the workflow is easy: Stop running if the task has been completed:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg04-workflow-step-1.png"><img class="alignnone size-full wp-image-111" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg04-workflow-step-1.png" alt="Stop processing if the task has been completed." width="500" height="390" /></a></p>
<p>The second step is more interesting.  This step, labeled &#8220;Send Initial Email,&#8221; obviously sends the first email.  However, it also sets up the subsequent reminder.  Let&#8217;s see how that works:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg05-workflow-send-initial-email.png"><img class="alignnone size-full wp-image-112" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg05-workflow-send-initial-email.png" alt="Send the initial email." width="500" height="390" /></a></p>
<p>Note that this task only runs if our task column, &#8220;FirstEmailReminderSent&#8221; is equal to No.  Since we were careful to specify &#8220;no&#8221; as this column&#8217;s default value, we know this step will run (provided that we got past the first step above).</p>
<p>First, we send the reminder email.</p>
<p>Then, we set FirstEmailReminderSent to Yes.  This ensures that this particular step never runs again.</p>
<p>Next, we pause for one day.</p>
<p>Once our pause completes, we want to start looping.  We do this by &#8220;poking&#8221; the task by changing any field of the current item.  When we do this, from SharePoint workflow&#8217;s  perspective, the item has been changed.  Since we checked &#8220;Automatically start this workflow when an item is changed,&#8221; it starts the workflow all over again.   We could pick any field but since we need to &#8220;poke&#8221; the current item, we may as well derive some business value at the same time.  We&#8217;ll use the EmailReminderCount field.  This way, we can poke it and know how many times the reminder has been sent, killing two birds with one stone.  The next series of screen shots show how to increment that counter.</p>
<p>First, we create a workflow variable as shown:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg06-workflow-edit-variable-temporary-counter.png"><img class="alignnone size-full wp-image-113" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg06-workflow-edit-variable-temporary-counter.png" alt="Insert the TemporaryCounter variable." width="196" height="175" /></a></p>
<p>Copy the current value of EmailReminderCount to our TemporaryCounter variable using the &#8220;Set Workflow Variable&#8221; action:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg07-workflow-set-variable-temporary-counter.png"><img class="alignnone size-full wp-image-114" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg07-workflow-set-variable-temporary-counter.png" alt="Set the TemporaryCounter variable so that we can increment it later." width="401" height="198" /></a></p>
<p>Use the &#8220;Do Calculation&#8221; action to increment this by one.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg08-workflow-calculate-variable-action.png"><img class="alignnone size-full wp-image-115" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg08-workflow-calculate-variable-action.png" alt="Use the \" width="402" height="200" /></a></p>
<p>Finally, update the Task&#8217;s EmailReminderCount using the &#8220;Update Field in Current Item&#8221; action.</p>
<p>The third and final step looks very similar to the previous:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg09-workflow-send-subsequent-emails.png"><img class="alignnone size-full wp-image-116" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg09-workflow-send-subsequent-emails.png" alt="Send subsequent emails (any email after the initial email)." width="500" height="390" /></a></p>
<p>This step only runs if the task was not marked as completed and if the first email reminder has already been sent.</p>
<p>Workflow pauses for a day and then increments the EmailReminderCount by one.  Performing this update causes the workflow to start over again.  Assuming the user never marked the task as complete, SharePoint workflow skips the first steps (since task is not completed) and the second step (since FirstEmailReminderSent is still Yes), landing back here on the third step.  It sends the email and pauses 24 hours, pokes itself and keeps looping like this, forever, until the task is completed or it&#8217;s deleted.</p>
<p>The following series of screenshots capture a test environment where the pause has been set to a short time interval:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg10-tasks-runtime-reminder-count-incrementing.png"><img class="alignnone size-full wp-image-117" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg10-tasks-runtime-reminder-count-incrementing.png" alt="At runtime, we see that the email\'s sent counter is incrementing over time.  This could feed a KPI for better visibility." width="500" height="134" /></a></p>
<p>In the above screen shot, the system has sent three reminders and is still waiting for the workflow to be completed.</p>
<p>Here is the initial workflow history:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg11-workflow-history.png"><img class="alignnone size-full wp-image-118" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg11-workflow-history.png" alt="Workflow history.  The email reminder loop is still running at this time." width="500" height="334" /></a></p>
<p>Here is how the task is marked complete:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg12-worfklow-completing-the-task.png"><img class="alignnone size-full wp-image-119" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg12-worfklow-completing-the-task.png" alt="Complete the task to stop the worfklow from looping any more." width="500" height="194" /></a></p>
<p>Here is the final workflow history:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg13-workflow-history-final.png"><img class="alignnone size-full wp-image-120" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg13-workflow-history-final.png" alt="Final workflow history after the task has been completed." width="500" height="295" /></a></p>
<p><strong>Limitations</strong></p>
<p>SharePoint Designer workflow is &#8230; limited.  There are several important limitations, but one of the most important for most users to understand is that these workflow solutions cannot be easily ported from one environment to another.  In fact, they cannot be easily ported anywhere, period.  There are clever workarounds to this problem, but that&#8217;s for a future article. (Hint -edit the XOML file directly, replacing task, list and other GUIDs manually).</p>
<p>Second, the workflow history is a bit garbled.  Conceptually, this is just one happy workflow.  However, at a machine/SharePoint level, we really have multiple instances of the same workflow.  This isn&#8217;t a problem for SharePoint, but it does sew confusion in a reporting sense.  As the final workflow history screen shows, even though we humans think just one workflow actually ran for this task (the Daily Reminder workflow), SharePoint shows five separate histories.  In our reminder scenario, this really isn&#8217;t a problem.  Each workflow history represents one email reminder.  However, if we had extensive logging and other complicated activities taking place, it would be hard to decipher the history and required a lot of clicking.  There is a clever solution to this problem as well, again for a future article.  (Hint &#8211; create entries in a custom list using a common key field to group them together).</p>
<p>Finally, it is important to realize that WSS and MOSS service pack 1 introduced a security feature that prevents a system administration account from starting any workflow automatically (though this was recently amended with the <a href="http://blogs.msdn.com/sharepoint/archive/2008/07/15/announcing-availability-of-infrastructure-updates.aspx">07/15/08 infrastructure update</a>).  If you&#8217;re testing this out in your environment and nothing seems to be happening, log in to the system as a non-admin account:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg14-sign-in-as-different-user.png"><img class="alignnone size-full wp-image-109" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/pg14-sign-in-as-different-user.png" alt="Signing in as a different user.  Do this to avoid testing as a system administrator.  That way lies madness." width="317" height="209" /></a></p>
<p><strong>State Machines in SharePoint Designer?  Looping?  Preposterous!</strong></p>
<p>As hinted at early on, this solution actually defines a state machine.  It uses the task itself as a persistent store for state data.  This workflow defines the following states:</p>
<ul>
<li>Starting state: Sending a first reminder.</li>
<li>Reminder state: Sending a subsequent reminder.</li>
<li>End state: Marking the task as complete.</li>
</ul>
<p>It&#8217;s not hard to imagine creating other kinds of state machines using this approach.</p>
<p>There is a real risk of pushing beyond reasonable business scenarios for which SharePoint Designer was designed (and some might argue that we already have).  Keep that in mind.  A complicated state machine workflow should be developed using visual studio with its close-to-the-metal workflow building tool set.</p>
<p><strong>Extending the Solution</strong></p>
<p>Several common sense extensions come to mind:</p>
<ul>
<li>Weekends: Incorporate some logic to determine whether the current date is a non-business day. If it is, simply pause for 24 hours before running again.</li>
<li>KPIs: Integrate this solution with a KPI. If the user requires many reminders, turn amber and eventually red to indicate a seriously overdue task.</li>
<li>Escalation: if a given task requires too many reminders, fire off an email to a manager.</li>
<li>Due Date Aware: Don&#8217;t send an email reminder for task unless it has passed its due date.</li>
</ul>
<p><strong>Conclusion</strong></p>
<p>This article describes a fully functional email reminder system.  The solution leverages core WSS workflow technology and uses a relatively friendly tool, SharePoint Designer, to do it.  This means it does not require MOSS but works in MOSS (since MOSS extends WSS).</p>
<p>Although the business example focuses on tasks, it should be clear that the pattern described here can fit into many different business scenarios that require repetitive (looping) actions over a period of time.  Simply define how the loop should end, what it should do in the first iteration and what it should do for subsequent iterations.</p>
<p>Too often, we hear that SharePoint Designer workflow can&#8217;t loop, can&#8217;t create state machines, is terribly limited and crippled, etc.  With a little imagination, we can prove the critics wrong and build simple yet powerful workflow solutions using this tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/development/the-dog-ate-my-task-use-sharepoint-designer-to-email-daily-task-reminders/feed</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
	</channel>
</rss>
