<?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; Workflow</title>
	<atom:link href="http://sharepointmagazine.net/tag/workflow/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>Go Green with SharePoint</title>
		<link>http://sharepointmagazine.net/news/go-green-with-sharepoint</link>
		<comments>http://sharepointmagazine.net/news/go-green-with-sharepoint#comments</comments>
		<pubDate>Tue, 16 Jun 2009 08:12:17 +0000</pubDate>
		<dc:creator>Anand</dc:creator>
				<category><![CDATA[Analysis]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[carbon]]></category>
		<category><![CDATA[green]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=3520</guid>
		<description><![CDATA[Organizations are constantly looking for ways to cut costs, but don’t realize that those cost cutting measures may also have positive environmental effects that can increase goodwill and shareholder value.]]></description>
			<content:encoded><![CDATA[<p><strong>Go Green with Office SharePoint Server</strong></p>
<p>1. Introduction<br />
2. Benefits of going green with SharePoint<br />
3. Knowledge Management – Going green<br />
4. Go Green – Green Benefits of Content Management<br />
<strong></strong></p>
<p><span style="text-decoration: underline;"><strong>Introduction</strong></span><br />
Organizations are constantly looking for ways to cut costs, but don’t realize that those cost cutting measures may also have positive environmental effects that can increase goodwill and shareholder value.</p>
<p>Microsoft SharePoint solutions provide tremendous return on investment, but also make your organization more environmentally conscious or “green” by cutting the consumption of paper. Many organizations around the world are utilizing IT solutions to realize their green initiatives. One such technology is Microsoft Office SharePoint 2007</p>
<p>For example: There are government-sponsored green initiatives currently underway. In 2003, the United Nations Economic Commission for Europe enacted a strategy to form a “Roadmap for Paperless Trade”.<br />
(http://www.unece.org/cefact/publica/ece_trd_371e.pdf)</p>
<p>The commission discovered that by moving from paper document processes to electronic technologies, they increased security and transparency in supply chains (Trading industry) and provided both the business sector with higher revenues and costs savings.</p>
<p><span style="text-decoration: underline;"><strong>Benefits of going green with SharePoint</strong></span><br />
Information and Communications Technologies are transforming our world on a daily basis. SharePoint enables organizations to control the creation, routing, approval, and publishing of documents. Many organizations use documents in paper format such as invoices, patient records, insurance forms, and corporate policies. These documents are typically copied and dispersed to wherever they are needed—often too many disparate locations. By converting these paper based documents and processes to electronic procedures, a single copy can be accessed electronically from any location without it being printed, shipped and then later archived or discarded.</p>
<p>Here is how you can calculate how much of environmental impact you have contributed and thereby saving how many trees?<br />
By using SharePoint Content management solution, the savings realized by the company can be translated into positive effects on the environment.</p>
<p><strong>How do you calculate?</strong><br />
1 tree makes 16.67 reams of copy paper or 8,333.3 sheets<br />
1 ream (500 sheets) uses 6% of a tree</p>
<p>http://www.conservatree.com/learn/EnviroIssues/TreeStats.shtml</p>
<p>For the a Company which uses 2,000,000 pages, the number of trees saved are calculated as below:<br />
<strong><em>Calculating Paper Saving’s</em></strong><br />
Total Pages 2,000,000<br />
Reams of Paper (500 sheets/ream) 4,000<br />
Number of Trees Saved (17 reams/tree) 235</p>
<p><strong>Other benefits Using SharePoint</strong></p>
<p><span style="text-decoration: underline;">Real Estate</span><br />
Not storing paper has two benefits regarding real estate – paper storage space and office space. This is space that would require energy consumption for heating, lighting, and humidity control. Beyond that there is also the impact on the environment of using the physical space as a warehouse as opposed to, say, a reserve forest or wetland.</p>
<p>Another example of the real estate impact of storing physical documents is the fact that a paper document is only available at a single location. By storing documents electronically, they can be access in multiple locations, even simultaneously.</p>
<p><span style="text-decoration: underline;">Lifestyle Benefits</span><br />
Putting documents online reduces the number of employees who are commuting to an office. This has tremendous impact on the environment, but also on employee lifestyle. Some organizations are beginning to assign lifestyle scores to projects. While analyzing return on investment and other facets of a project, organizations can assess the impact on employee lifestyle. Raising lifestyle benefits makes a company a more attractive employer and helps organizations with recruiting.</p>
<p><span style="text-decoration: underline;">Technology Benefits</span><br />
Organizations which use SharePoint solutions are also well-positioned to meet their business challenges as they now have a scalable and manageable technology platform which is hot-pluggable and that it can be integrated with other standards-based applications and tools. Since .Net Framework is compatible with SharePoint, SharePoint also gives you an opportunity to customize application which will help the user community to accept the cultural change.</p>
<p><span style="text-decoration: underline;"><strong>Knowledge Management – Going green</strong></span><br />
&#8220;Going green&#8221; has become a topic of increased attention, but it’s nothing new to knowledge management. By its nature, knowledge management promotes efficiency and optimal use of resources, which often reduces the amount of energy required to achieve a given goal.</p>
<p>Knowledge Management (KM) awareness is creating new interest in KM solutions that can improve business performance while reducing environmental effects. Knowledge management using SharePoint plays an important role improving their energy management to optimize the use of office equipment and energy in buildings. SharePoint knowledge management solutions, including records management (RM) and enterprise content management (ECM), reduce the use of paper. In addition, online collaboration and online meeting solutions can greatly cut down on the need for travel to meetings.</p>
<p>In the past, larger companies were well positioned to make use of knowledge management solutions that transformed paper-based information into digital information because they could justify and afford the investment. Now, the small and medium-sized business (SMB) market has more choices, with the lower entry costs for software as a service (SaaS) products. SharePoint provides an option for SharePoint online hosting KM solutions.</p>
<p><span style="text-decoration: underline;"><strong>Go Green – Green Benefits of Content Management</strong></span><br />
SharePoint offers so many opportunities to go Green, Top six ways to go Green with SharePoint:<br />
1. Save money on paper – and reduce your environmental footprint at the same time.</p>
<p>2. Increase the effectiveness of core processes.<br />
Think about the benefits of SharePoint technologies in just a single core process – finance. Driving paper from financial processes allows an accounts payable group to pay invoices faster, taking advantage of discounts for early payment. It allows an accounts receivable group to improve cash flows and reduce the number of days that sales are outstanding. The cost of processing an invoice can typically be cut by a factor of 10, creating savings that drop directly to the bottom line. These kinds of savings can usually be replicated in other paper intensive processes, yielding BOTH bottom line AND Green benefits.</p>
<p>3. Truly integrate your field operations.<br />
The application of distributed capture technologies – using a scanner in a field office to process locally created paper and electronically store it in a central location within SharePoint. These scanned documents can be accessed from any location over the internet for immediate review. Distributed capture solutions often pay for themselves just through savings in courier and shipping costs. But taking courier and overnight services off the road also translates into significant direct environmental benefits.</p>
<p>4. By using SharePoint we can reduce real estate costs. Less paper means fewer filing cabinets means less real estate – which reduces cost, but also significantly reduces your environmental footprint.</p>
<p>5. SharePoint helps in improving employee productivity.<br />
As a content management tool, SharePoint proves to be the best in the industry for the following:</p>
<p><img class="alignnone" title="SharePoint Tick" src="http://sharepointmagazine.net/images/icons/tick.png" alt="SharePoint Tick" width="16" height="16" /> Collaboration<br />
<img class="alignnone" title="SharePoint Tick" src="http://sharepointmagazine.net/images/icons/tick.png" alt="SharePoint Tick" width="16" height="16" /> Portal<br />
<img class="alignnone" title="SharePoint Tick" src="http://sharepointmagazine.net/images/icons/tick.png" alt="SharePoint Tick" width="16" height="16" /> Enterprise Search<br />
<img class="alignnone" title="SharePoint Tick" src="http://sharepointmagazine.net/images/icons/tick.png" alt="SharePoint Tick" width="16" height="16" /> Enterprise Content Management<br />
<img class="alignnone" title="SharePoint Tick" src="http://sharepointmagazine.net/images/icons/tick.png" alt="SharePoint Tick" width="16" height="16" /> Forms Driven Business Process<br />
<img class="alignnone" title="SharePoint Tick" src="http://sharepointmagazine.net/images/icons/tick.png" alt="SharePoint Tick" width="16" height="16" /> Business Intelligence</p>
<p>6. Reduce off-site storage costs. Off-site storage of paper is expensive, often requiring rental and maintenance fees as well as significant transportation costs to the facility. SharePoint provides a SaaS option for hosting the portlet.</p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/news/go-green-with-sharepoint/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Review: Workflows with Nintex Workflow 2007</title>
		<link>http://sharepointmagazine.net/products/review-workflows-with-nintex-workflow-2007</link>
		<comments>http://sharepointmagazine.net/products/review-workflows-with-nintex-workflow-2007#comments</comments>
		<pubDate>Wed, 03 Jun 2009 03:46:18 +0000</pubDate>
		<dc:creator>furuknap</dc:creator>
				<category><![CDATA[Products]]></category>
		<category><![CDATA[Furuknap]]></category>
		<category><![CDATA[journal]]></category>
		<category><![CDATA[nintex]]></category>
		<category><![CDATA[product]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[usp]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=3437</guid>
		<description><![CDATA[For the last couple of months, I have been working with Nintex Workflow 2007 while researching a new issue of the Understanding SharePoint Journal. That research lead to the recently released special issue of USP Journal, titled Using Nintex Workflow 2007. You can get that issue for free now, and I’ll tell you how at the end of this article.]]></description>
			<content:encoded><![CDATA[<p>For the last couple of months, I have been working with Nintex Workflow 2007 while researching a new issue of the Understanding SharePoint Journal. That research lead to the recently released special issue of USP Journal, titled Using Nintex Workflow 2007. You can get that issue for free now, and I’ll tell you how at the end of this article.</p>
<p>In this article, I’m am going to introduce you to some of the features of Nintex Workflow 2007 (NW), and show you why I think this is a really cool product. I&#8217;ll also tell you about some of the annoyances I found.</p>
<p><strong>Full Disclosure:</strong> Now, I’m trying to be as unbiased as I can and give you my honest opinion, but you should know that I was paid by Nintex for creating the USP Journal issue. No, they didn&#8217;t get any editorial control, but I was still paid. As such, feel free to hold a salt shaker ready and take what I say with an appropriate grain of salt.</p>
<h1>Nintex Workflow in a Nutshell</h1>
<p>Basically, Nintex is an easy to use workflow add-on to SharePoint. If you have worked with workflow in SharePoint before, chances are you have either worked with SharePoint Designer or Visual Studio. Both of these options are well suited for their intended use, but there is a big gap between SPD and VS that NW fills really well.</p>
<p>On one side, SharePoint Designer offers an incredibly easy and free way of adding simple workflows to a SharePoint site. Using a bit of creativity you can even create fairly complex solutions, using only the built-in actions and features. However, SharePoint Designer lacks scalability and flexibility, and re-use is at best very cumbersome.</p>
<p>On the other side is Visual Studio, which is like having your own thermo nuclear device. It’s incredibly powerful and you can more or less control at least parts of the world, but you had better know exactly what you are doing, or you risk your solution blowing up in your face. Where Visual Studio offers immense power, its learning curve is so steep, it can scare the most die-hard mountaineer.</p>
<p>Nintex Workflow bridges the gap between these two solutions, by giving end users some of the power of a Visual Studio solution while maintaining the ease of use and gentle learning curve of SharePoint Designer. In addition, NW includes some truly unique features, such as the ability to combine sequential and state-machine workflows and user interaction with tasks through email in a feature that deserves mention for its name alone: LazyApproval.</p>
<h1>Authoring Workflows in Nintex</h1>
<p>What initially sparked my interest for NW was the interface for designing workflows. The interface resembles the workflow designer in Visual Studio in that you get a visual overview of the ‘flow’ part of your workflow. Branching, loops, and state machines are presented in what I think is a really intuitive interface that makes it easy for end users to understand what is going on.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/figure54.png" border="0" alt="Figure 54" width="576" height="551" /></p>
<p>What makes this workflow designer especially friendly to end users is that it resides inside SharePoint itself. Using scripting and more fancy scripting than I’d dare to undertake, you are actually designing your entire workflow right inside SharePoint with no client software to install or learn at all. You simply drag-and-drop actions from the action menu onto the designer surface and configure each action using dialog boxes.</p>
<p>True, the interface of the Visual Studio workflow designer offers more options and allows for a greater degree of flexibility, but Visual Studio is still an all-or-nothing package; if you want the added flexibility, you also need to deal with the added complexity. That complexity is probably far more than any end users are prepared to handle.</p>
<h1>Templates and Snippets</h1>
<p>Another nice feature is the ability to easily create templates of existing workflows. You can create the generic templates for common tasks such as approval or customer follow-up and then re-use the templates when creating new workflows. This saves a lot of time if you are creating similar workflows or have common tasks used by several units in an organization.</p>
<p>Another option for workflow re-use is snippets. A snippet is basically a set of workflow actions stored as a single action. You create these snippets in the workflow designer, and they become part of your available actions for use in any workflow. For example, you might create a snippet to notify an item or document owner about changes to that item or document. Whenever you want to include that functionality in your workflow, you simply drag the entire snippet onto the workflow designer, and you get that functionality added without having to re-create all the individual actions.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/figure38.png" border="0" alt="Figure 38" width="216" height="247" /></p>
<h1>Go with the Flow</h1>
<p>If there is one thing I really miss, especially in SharePoint Designer workflows, it is better debugging and tracking of what is going on. A common approach is to add a lot of history logging to track what the workflow is doing. In Visual Studio, you can attach the debugger and step through the entire workflow, which is really nice and gives developers extreme control.</p>
<p>While NW lacks the stepping option, it does offer a very nice workflow information page far superior to the default workflow status page of SharePoint. On that workflow information page, you get a visual representation of your workflow, including which actions and branches are currently executing.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/figure56.png" border="0" alt="Figure 56" width="824" height="633" /></p>
<p>This workflow information page can also give you a detailed view where you can get a whole boatload of more information about the workflow execution, including how long each action takes, the outcome of conditions, who approves or disapproves which actions, and a range of other information.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/figure58.png" border="0" alt="Figure 58" width="824" height="617" /></p>
<p>The workflow information provided by NW goes a long way towards providing the debugging information you need to figure out workflow bottlenecks, logical errors, and other problems you may encounter.</p>
<h1>State of the Machine</h1>
<p>The final thing I want to point out as truly unique in NW is the support for state machines. You may wonder what is so special about supporting state machines, after all, most workflow products support state machines in some fashion.</p>
<p>What is really nice in NW, though, is that a state machine is simply an action, just like any other multi-branch action. This means you can combine state machines with sequential workflows inside the same workflow. For example, you may have a long running customer follow-up process, in which one part of the workflow consists of contract negotiations. That contract negotiation may move back and forth between different states, but is still only part of a longer workflow in which the ultimate goal is to make the customer happy.</p>
<p>In NW, you can simply add a state machine action and configure that action as you would if you had developed a stand-alone state machine workflow. Then, after that part of the workflow completes, you can continue in a sequential workflow, or even transition into a new state machine inside the same workflow.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/figure79.png" border="0" alt="Figure 79" width="905" height="525" /></p>
<h1>OK, So What’s the Catch?</h1>
<p>Alright, I’ve said enough about the cool things, so it makes sense to point out some of the weaknesses as well. Note that most of these issues are annoyances at worst.</p>
<p>First, the interface for controlling configuration scopes leave a lot to be desired. Basically, you can configure settings for sites and site collections, and the scopes control inheritance and all that, but the way that Nintex has solved the interface is not good. You need to pay attention to small pieces of texts on the page to know whether you are configuring for a site or for the entire site collection.</p>
<p>Second, NW supports setting up holidays to avoid workflow activities while no one is available to respond to tasks or interact with the workflow. However, the way the holidays are configured could have been done so much better. You can only add one day at a time, so if you are closing the office for two weeks during summer you need to add each day of those weeks individually. Really sad for schools with months of vacation at a time.</p>
<p>Third, the workflow designer can become cluttered when you are creating complex workflows, especially when using multiple branches. The branches keep expanding horizontally and will eventually fill any screen size if you have enough branches. And frankly, ‘enough’ branches is too low a number for example in state machines with many states. The same applies to the workflow information; to get an overview, you need to do a lot of scrolling. A “zoom out” function would be useful.</p>
<p>None of these issues are deal-breakers, though. It feels to me like they have gone 95% of the way towards making a perfect workflow solution, but with a product like this, the last 5% can be annoying.</p>
<p>And still, their 95% are still light-years ahead of anything else I have seen in this niche.</p>
<h1>Want to Learn More?</h1>
<p>The state machine image above is an example from the USP Journal I mentioned in the beginning of this article. In that issue, you’ll learn how to develop workflows in Nintex Workflow. The image shows part of a “get well card” that you’ll develop during the exercises in the issue. I’ll show you how to install and configure NW, familiarize you with the Workflow Designer, teach you at least some of the actions available, as well as explain the logic of how various tasks are done, such as the above example of inline state machines.</p>
<p>You can get the 128-page issue from the <a href="http://www.understandingsharepoint.com/url/30104" target="_blank">issue download page</a>, and as I said, it’s free, as in beer.</p>
<p>.b</p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/products/review-workflows-with-nintex-workflow-2007/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A tribute to the humble &#8220;leave form&#8221; &#8211; Part 7</title>
		<link>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-7</link>
		<comments>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-7#comments</comments>
		<pubDate>Tue, 10 Feb 2009 13:08:04 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[bpm]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=1930</guid>
		<description><![CDATA[...it pains me greatly to have to inform you that this seventh edition of the series is one of those posts where you have to put on the brakes and explain some really boring conceptual stuff to proceed with the rest of the series. Yeah, I know - theory is boring and sucky and you just wanna get into the nuts and bolts of it all. But, as Homer often demonstrates, sometimes we have to defy our genetic programming and actually read the instructions...]]></description>
			<content:encoded><![CDATA[<p>Hi all</p>
<p>Welcome to edition 7 of this seemingly never-ending tribute to the humble annual leave (vacation) form. This is getting to be like the &#8220;Friday the 13th&#8221; series of movies &#8211; they never stop!</p>
<p>First up, I want to categorically state that, as a heterosexual Australian male, I have a few stereotypical personality traits . I enjoy beer, kung-fu movies, <a href="http://en.wikipedia.org/wiki/Burger_Rings" target="_blank">Burger Rings</a>, <a href="http://en.wikipedia.org/wiki/Vegemite" target="_blank">Vegemite</a> and <a href="http://en.wikipedia.org/wiki/Tim_tams" target="_blank">Tim-Tams</a>, love the cricket (especially playing India) and most importantly of all, I do not read instructions. Period. I think that ignoring the RTFM rule is a characteristic of all of humanity but Australians in particular seem to celebrate this trait as something endearing.</p>
<p>Therefore, it pains me greatly to have to inform you that this seventh edition of the series is one of those posts where you have to put on the brakes and explain some really boring conceptual stuff to proceed with the rest of the series. Yeah, I know &#8211; theory is boring and sucky and you just wanna get into the nuts and bolts of it all. But, as Homer demonstrates below, sometimes we have to defy our genetic programming and actually read the instructions. The alternative is a SharePoint solution equivalent to that of Homers BBQ.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image36.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb26.png" border="0" alt="image" width="372" height="278" /></a></p>
<p>This post will deal with some of the mechanics of form submission and form publishing.</p>
<h2>What has gone before&#8230;</h2>
<p>The first few posts in this series are starting to get hazy &#8211; it seems so long ago now. To sum it all up in a nutshell, we introduced the leave form as a means to introduce a lot of key SharePoint features in an easy to understand and relevant way. We set several requirements that we had to achieve.</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the right supervisor</li>
<li>We have a central leave calendar to updateAt the end of part 6 we were working on validation of dates. We added some validation rules to ensure that you could not return to work before you started your leave of absence. But at the end of that post, I showed how a published form did <strong>not </strong>obey our data validation rule, where the form was set to prohibit incorrect dates, yet I was able to click save and put the form straight into the document library. What the&#8230;?Why did this occur?<br />
<h2>Saving vs Submitting &#8211; form confusion</h2>
<p>Like everything else designed by nerdy engineers, InfoPath and Forms Services can be used in a few different ways. This offers flexibility of course, but has the disadvantage that if the flexibility is not well understood (i.e not reading the instructions <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ), it is easy to cause user confusion. Homer is a classic case of a person who, when faced with two choices, will always pick the wrong one.</p>
<p>You have to remember that InfoPath started out as a program installed onto your PC, along with other MSOffice applications. Thus, historically, an InfoPath form is just another type of document. In its simplest (and default) scenario, the form is very much like any other MSOffice document in that you create/open the form, edit it and then save it.</p>
<p>But hang on a second! Most of the time, the data collected in the form is part of a larger business process. Also most of the time, business process needs to do &#8220;stuff&#8221; with the information that the user has entered. In other words, the data usually doesn&#8217;t stay in the forms that users fill out.</p>
<p>So the InfoPath designers, wanting to please everybody, designed InfoPath in such a way that <strong>saving </strong>a form and <strong>submitting </strong>a form are two different things. Homer Simpson doesn&#8217;t care about this nor should he. He just wants to fill out the form so he can go back to dreaming about the land of chocolate.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image37.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb27.png" border="0" alt="image" width="240" height="186" /></a></p>
<p>Here is the key thing you need to know, though. Saving a form is, in effect, performed on the presumption that the form <strong>is still a work in progress</strong>. Saving the form should be thought about in the same way you would save a word document after performing some edits. Because the form is still a work in progress, data validation should <strong>not take place</strong>.</p>
<p>But at some point the form stops being a &#8216;document&#8217; and becomes&#8230;well&#8230; a form! It is complete and no more edits should be made. This is when you actually <strong>submit</strong> the form!</p>
<p>Submitting a form <strong>triggers the data validation rules</strong> that were set up in <a title="part 6" href="http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6">part 6</a>.</p>
<h2>Big deal&#8230;When does this get hard, Paul?</h2>
<p>Okay, so you may not think that there is really that much of a drama with the whole &#8220;save vs submit&#8221; thing. But when InfoPath is integrated with SharePoint via Forms Services, it can get complicated. You see, InfoPath allows you to create forms that submit their data to <strong>one or more locations</strong>. For example, the Springfield Nuclear Power Plant leave form could be set up so that when Homer submits his application, the data is sent to a database, and a copy of each completed form is also sent in an e-mail message to Waylon Smithers and Monty Burns.</p>
<p>For reference, here are the places that InfoPath can submit to;</p>
<ul>
<li>A Microsoft Access or Microsoft SQL Server database</li>
<li>A Web service</li>
<li>A server running Microsoft Windows SharePoint Services</li>
<li>In an e-mail message</li>
<li>An application on a Web server</li>
<li>A custom application that hosts InfoPath</li>
</ul>
<p>Now, given that this series of articles is about SharePoint, which option of the above list do you think we are interested in? You guessed it! The third option in the above list is SharePoint.</p>
<p>But here is the root cause of the confusion, when you <strong>publish</strong> an InfoPath form to SharePoint, all forms that you fill in end up being created in a document library. Back in part 4 of this series, we first published the form and as part of that process, created a form library called &#8220;Leave Forms&#8221;. Consider the screenshot below. We are about to create a new form in this library.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>Below is a screenshot of the new form to fill out. Note the toolbar at the top with a &#8220;Save&#8221; and &#8220;Save As&#8221; options. If you then click &#8216;Save&#8221; on the form, it will prompt you to save into the above document library.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image43.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb32.png" border="0" alt="image" width="434" height="251" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image39.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb29.png" border="0" alt="image" width="317" height="210" /></a></p>
<p>Therefore, if you use the &#8220;Save&#8221; option, the &#8220;In-progress&#8221; copies of the form are stored in the document library and <strong>no data validation</strong> has taken place. You really have not submitted the form at all.</p>
<p>Does the end user realise this? Some might &#8211; but come on! This is Homer J Simpson we are talking about here!</p>
<p>So clearly we need to submit this form because in <a title="part 6" href="http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6">part 6</a> we added validation rules that need to be checked. But, what the&#8230;? &#8211; How the hell do I submit?</p>
<h2>Setting up form submission</h2>
<p><em>Real programmer disclaimer: Yes I know there are other ways of doing all of this, but remember &#8211; this series of posts is for beginners.</em></p>
<p>Okay, for now the theory bit is over, and now we get to play with InfoPath again. We are going to add the form submission capability to our existing form so that we can actually submit the form. The thing is, I am also going to *remove* the &#8220;Save&#8221; and &#8220;Save As&#8221; options from that toolbar, so that the only action you can make is to submit.</p>
<p>Why would I do this? Several reasons.</p>
<ul>
<li>It is a simple form and really, you either fill it in and submit or you don&#8217;t. There really isn&#8217;t that much of an imperative to save this form, prior to submitting it.</li>
<li>When you submit a form, and you are submitting to a SharePoint library, the submitted form is saved. Therefore, I don&#8217;t need a &#8220;work in progress&#8221; copy.</li>
<li>The Homer factor. If you supply a &#8220;Submit&#8221; and a &#8220;Save&#8221; button, you know full well that Homer will go and click the &#8220;Save&#8221; button, when he should be clicking &#8220;Submit&#8221;. As soon as the save dialog pops up, he won&#8217;t know what to do. At this point he will lose interest and fall asleep.</li>
</ul>
<h2>Hiding save buttons</h2>
<p>So, start InfoPath, open up the leave form in design mode, and choose &#8220;Form options&#8221; from the &#8220;Tools&#8221; menu.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image40.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb30.png" border="0" alt="image" width="212" height="178" /></a></p>
<p>From the list of options, choose &#8220;Open and Save&#8221; and <strong>uncheck</strong> the &#8220;Save and Save As&#8221; checkbox as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image42.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb31.png" border="0" alt="image" width="418" height="356" /></a></p>
<p>Click &#8220;OK&#8221; and republish this form to SharePoint using the steps described in part 4. Note the before and after screenshots below <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image43.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb32.png" border="0" alt="image" width="383" height="222" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image44.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb33.png" border="0" alt="image" width="317" height="220" /></a></p>
<p>Spot the difference? The &#8220;Save&#8221; and &#8220;Save As&#8221; buttons are missing, and with that I can confidently say that I have now made this form Homer proof because he can&#8217;t inadvertently click &#8220;Save&#8221; and think he has submitted the form. Of course, it is so Homer proof that he now has no way to submit the form, so now we have to enable the &#8220;Submit&#8221; button.</p>
<h2>Enabling the submit button</h2>
<p>Once again, open the leave form in design mode, and choose &#8220;Submit Options&#8221; from the &#8220;Tools&#8221; menu. InfoPath will dutifully display a fairly nondescript dialog box that, at first glance, seems rather simple. There is a checkbox that you need to tick to &#8220;enable form submission&#8221;. Sweet! How easy is that?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image45.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb34.png" border="0" alt="image" width="210" height="168" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image47.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb35.png" border="0" alt="image" width="244" height="211" /></a></p>
<p>Upon checking that box, you now have to choose where you are going to send form data to. The default option is &#8220;Email&#8221;, but we want to send it to a SharePoint document library, as shown below. Choose SharePoint and then click OK.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image48.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb36.png" border="0" alt="image" width="244" height="139" /></a></p>
<p>Uh oh! Did I say this was going to be easy? Okay I lied <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image50.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb37.png" border="0" alt="image" width="527" height="82" /></a></p>
<p>So, what is this message telling us? &#8220;You must select a data connection for submitting to a SharePoint document library&#8221;. Hmmm&#8230;I hope that something about that message sounds vaguely familiar to you. That is because this is <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">not the first time</a> we have dealt with data connections.</p>
<h2>Data Connections revisited</h2>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb.png" border="0" alt="image" width="159" height="156" /></a></p>
<p>Way back in part 5, you earned your CCLFD certification by creating a data source that automatically identified Homer by talking to SharePoint web services. If you missed that post, then I suggest reading it, as it is a great example of utilising data connections to *receive* data into InfoPath.</p>
<p>In part 5, we set up a data connection to a webservice by following a wizard. To remind you of how it was done, I have copied the screenshots to this post.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image12.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb12.png" border="0" alt="image" width="226" height="208" /></a><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image13.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb13.png" border="0" alt="image" width="412" height="121" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image14.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb14.png" border="0" alt="image" width="244" height="162" /></a></p>
<p>Now, take a look at the second screenshot from the above three. It is asking you to create a connection to receive or submit data and at that time we were receiving data. Guess which one we are doing this time? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So, back to our &#8220;Submit Options&#8221; dialog box. We were not able to click &#8220;OK&#8221;, because we have not created a data connection to submit the data. Let&#8217;s now start this process by clicking the &#8220;Add&#8221; button. Given that you have already told SharePoint that you want to submit to a document library, InfoPath now wants to know the name of that document library and the name of the file that will be created by the submit.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image51.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb38.png" border="0" alt="image" width="331" height="286" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image52.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb39.png" border="0" alt="image" width="423" height="286" /></a></p>
<p>Now, given that the entire staff of the nuclear power plant will be filling out this form, we don&#8217;t want to simply call the submitted form &#8220;Form&#8221; as suggested by default. If we did that, we would end up with a document library containing a single file called &#8220;FORM&#8221; due to the fact that all previous &#8220;FORM&#8221; files would have been overwritten and replaced by the current &#8220;FORM&#8221;.</p>
<p>Luckily the InfoPath team anticipated this and the filename can be dynamically generated using functions. (We looked at functions early in <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">part 5</a>).</p>
<p>First up though, I will specify the document library to submit completed forms to. It will be in the same document library that we was created when we first published the leave form in part 4,the imaginatively titled &#8220;Leave Forms&#8221;. Below is the library as it is inside the radiactivenet site. Note the URL is exactly what I entered into the &#8220;Document Library&#8221; field.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image53.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb40.png" border="0" alt="image" width="462" height="250" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image54.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb41.png" border="0" alt="image" width="570" height="219" /></a></p>
<h2>A unique filename</h2>
<p>The final step for submission is to create an auto-generated filename that is unique. Although the principle is dead simple, this bit is actually tricky when you do it for the first time.</p>
<p>The file naming convention to be used will be as follows:</p>
<p>&#8220;Leave Form &#8211; &#8221; + [EmployeeName field] + &#8221; &#8211; &#8220;, [LeaveType field] + &#8221; &#8211; &#8221; + [todays date]</p>
<p>Here are some examples of this convention in action with various staff.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image56.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb42.png" border="0" alt="image" width="224" height="178" /></a></p>
<ul>
<li>&#8220;Leave Form &#8211; Homer Simpson &#8211; Sick &#8211; 2007-09-18&#8243;</li>
<li>&#8220;Leave Form &#8211; Lenny Leonard &#8211; Annual &#8211; 2008-11-22&#8243;</li>
<li>&#8220;Leave Form &#8211; Carl Carlson &#8211; Bereavement &#8211; 2008-12-25&#8243;</li>
</ul>
<p>So, how do we achieve this? Let&#8217;s get back to the screen where we are prompted to add a file name for a submitted form.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image54.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb41.png" border="0" alt="image" width="570" height="219" /></a></p>
<p>Click the &#8220;Fx&#8221; button to the right of the &#8220;File name&#8221; textbox and you will be presented with the (far too small to be user friendly) &#8220;Insert Formula&#8221; dialog box. We are going to create a formula that constructs the desired file name.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image57.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb43.png" border="0" alt="image" width="244" height="159" /></a></p>
<p>The first thing to note is that we will be using a combination of fixed text, the data entered on the form and built in InfoPath functions. To join all these together in the manner we want is referred to as <a href="http://en.wikipedia.org/wiki/Concatenation" target="_blank">concatenation</a>. Why do people call it concatenation? I have no idea but it&#8217;s obvious that an engineer thought up that name! <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>We start by inserting the concatenation function called &#8220;concat&#8221;. Click &#8220;Insert Function&#8221; and in the leftmost window choose the &#8220;Text&#8221; category. The function called &#8220;concat&#8221; should be the first one listed. Select it and click &#8220;OK&#8217; and you will see that a partially completed formula has been created.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image58.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb44.png" border="0" alt="image" width="282" height="193" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image59.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb45.png" border="0" alt="image" width="295" height="193" /></a></p>
<p>The first part of our file name is the text &#8220;Leave Form &#8211; &#8220;. So <strong>single click</strong> the first occurrence of the &#8220;double click to insert field&#8221; hyperlink and it will be highlighted. From here, simply type in the string &#8220;Leave Form &#8211; &#8221; (including the double quotes).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image60.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb46.png" border="0" alt="image" width="284" height="184" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image62.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb47.png" border="0" alt="image" width="283" height="184" /></a></p>
<p>The next part of the file name is the name of the employee. We already have this, because in part 5 we set up a data connection to automagically grab first name and surname and store it in the textbox called &#8220;EmployeeName&#8221;.</p>
<p><strong>Single click</strong> the next occurrence of the &#8220;double click to insert field&#8221; hyperlink and it will be highlighted. From here, click &#8220;Insert Field or Group&#8221; and choose &#8220;EmployeeName&#8221; from the list of fields.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image63.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb48.png" border="0" alt="image" width="286" height="185" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image64.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb49.png" border="0" alt="image" width="215" height="244" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image65.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb50.png" border="0" alt="image" width="284" height="184" /></a></p>
<p>Okay, so we have the &#8220;Leave Form &#8211; Homer Simpson&#8221; part done. Next we want a hyphen &#8221; &#8211; &#8221; and then the LeaveType field. By now you should be getting familiar editing the formula in the dialog box. Rather than bore you with even more screenshots, I&#8217;ll talk through the next 2 steps.</p>
<ul>
<li>Single click the next &#8220;double click to insert field&#8221; link.</li>
<li>Type in (note the leading and trailing space) &#8221; &#8211; &#8220;</li>
<li>Type in a comma (minus quotes) &#8220;,&#8221;</li>
<li>Click &#8220;Insert Field or Group&#8221; button</li>
<li>Choose the &#8220;LeaveType&#8221; field and click OK.</li>
</ul>
<p>If all has gone to the script, then you will see this in for formula box.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image66.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb51.png" border="0" alt="image" width="290" height="189" /></a></p>
<p><em>Note that you can use the mouse to place the cursor anywhere in the Formula textbox and modify what is there.</em></p>
<p>Finally, we need another hyphen and to insert another function. This time the function is called &#8220;time&#8221; and it returns the current date in a short locale based format.</p>
<ul>
<li>Referring to the above screenshot, place your cursor between the last letter of the underlined LeaveType (which is &#8220;e&#8221; ) and the closing bracket.</li>
<li>Type in (including the quotes and note the leading and trailing space) &#8221; &#8211; &#8220;</li>
<li>Type in a comma (minus quotes) &#8220;,&#8221;</li>
<li>Click &#8220;Insert Function&#8221; button</li>
<li>Choose &#8220;Date and Time&#8221; from the Categories List in the &#8220;Insert Function&#8221; dialog box</li>
<li>Choose &#8220;today&#8221; from the list of functions and click &#8220;OK&#8221;</li>
</ul>
<p>We are done! The final formula looks like this. Click &#8220;OK&#8221; and you now should be back at the data connection wizard (the second screenshot below).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image67.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb52.png" border="0" alt="image" width="299" height="192" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image69.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb53.png" border="0" alt="image" width="593" height="240" /></a></p>
<p>Click &#8220;NEXT&#8221; on the wizard, and we are prompted to give this data connection a name. Since this data connection has been created to submit leave forms to a document library called &#8220;Leave Forms&#8221;, I figured that a good name would be &#8220;Submit to Leave Form Library&#8221;. Click &#8220;Finish&#8221; and you are done!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image70.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb54.png" border="0" alt="image" width="597" height="404" /></a></p>
<p>To recap on what we have completed in this section, each time a form is submitted, its filename will be automatically specified and the end-user does not have to worry about it.</p>
<p>All rightie, then! Let&#8217;s republish this form to SharePoint and take a look at the effect.</p>
<h2>Testing it out</h2>
<p>Assuming everything worked, the effect of what we have done is immediately noticeable. We now have a &#8220;Submit&#8221; button on the form where the &#8220;Save&#8221; and &#8220;Save As&#8221; used to be. Sweet!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image71.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb55.png" border="0" alt="image" width="550" height="316" /></a></p>
<p>So let&#8217;s test the data validation rules that we created in part 6. If you recall, this form should not be submitted if the return date is before the start date. For that to really happen you would have to be Dr Who and use the Tardis to arrive before your departure&#8230;</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image72.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb56.png" border="0" alt="image" width="184" height="212" /></a></p>
<p>Below is the form with deliberately incorrect data (click to enlarge).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image73.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb57.png" border="0" alt="image" width="244" height="168" /></a></p>
<p>If I now click the newly visible &#8220;Submit&#8221; button, what happens? Ecccccxcelent! It refuses to submit the form.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image74.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb58.png" border="0" alt="image" width="600" height="88" /></a></p>
<p>I don&#8217;t know about you, but this is one of those error messages that some people simply will not read. Homer will no doubt call technical support but the point is, crap data has not gotten past the form in the first place.</p>
<p>Now, when we correct the fault and resubmit the form, it accepts!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image75.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb59.png" border="0" alt="image" width="447" height="200" /></a></p>
<p>Click &#8220;Close&#8221; and we now see the newly submitted form in the document library, saved with our file naming convention! Woohoo!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image76.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb60.png" border="0" alt="image" width="685" height="160" /></a></p>
<h2>Conclusion (Are we done yet?)</h2>
<p>We now have achieved the goal of ensuring that our form is validated before being submitted. From a skills point of view, you now have created data connections to both send and receive data and you have integrated your form with web services, as well as some nice data validation logic.</p>
<p>Waylon Smithers is still pleased with progress thus far, and Homer hasn&#8217;t managed to completely derail things just yet.</p>
<p>But unfortunately for all of us, there is still much work to do. The next post will spend some time pimping up this whole validation and submission process, illustrating a pitfall or two along the way.</p>
<p>Thanks for reading</p>
<p>Paul Culmsee</p>
<p><a href="http://www.sevensigma.com.au">www.sevensigma.com.au</a></p>
<p><a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></li>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-7/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>A tribute to the humble leave form &#8211; part 6</title>
		<link>http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6</link>
		<comments>http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6#comments</comments>
		<pubDate>Fri, 28 Nov 2008 09:29:13 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Help]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[leave]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=1498</guid>
		<description><![CDATA[This time around, let's take care of the "reduce data entry" requirement, and leverage some of InfoPath's useful features to make our form smarter.]]></description>
			<content:encoded><![CDATA[<p>Hi again</p>
<p>When I started this series of articles, I knew it would be quite a few parts and ambitious in its way. But after reading some of the other great articles on SharePoint Magazine, such as Bjørn Furuknap&#8217;s first article on <a href="http://sharepointmagazine.net/technical/development/customizing-the-user-experience-of-sharepoint-overview-of-the-default-sharepoint-interface-from-a-technical-point-of-view-part-1-of-6" target="_blank">customising the user experience</a>, I&#8217;m now feeling like I picked the easiest topic of all!</p>
<p>Seriously, Bjørn, part 1 of your series is the closest experience I can imagine to any man giving birth! I bet you feel relieved getting that one out of your system!</p>
<p>So, do I feel guilty that my subject matter is easier? Am I suffering nerdiness envy?</p>
<p>Hell, no! I&#8217;ll stick to my fantasy world of user acceptance testing with Homer Simpson any day!</p>
<h2>Previously&#8230;</h2>
<p><em>Given that there are big time gaps in getting these articles out, I&#8217;d just like to reiterate that this series is pitched at a very wide audience, so hard-core nerds will probably find it waffly and frustrating. But then again, most regular people find hard core nerds waffly and frustrating <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</em></p>
<p>I have been writing this series from the point of view of a frustrated implementation developer/engineer who has to deal with a clueless business development manager and a difficult customer. This, of course, is completely unfamiliar territory for all implementation developer/engineers because none of you reading this would have ever experienced such a situation, right? &#8230; hehe <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image1.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb1.png" border="0" alt="image" width="204" height="237" /></a></p>
<p>Part one of this series introduced some background and provided the requirements for the leave application/approval process for the Springfield nuclear power plant. Those requirements were:</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the appropriate supervisor</li>
<li>We have a central leave calendar to update</li>
<p>Parts two to four were really the &#8220;slick presales demo&#8221; parts of this series where the world is promised to the client and, hence, expectations were completely off the planet. Thus, we started out nice and easy in part <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-2" target="_blank">two</a> and <a href="http://sharepointmagazine.net/technical/administration/a-tribute-to-the-humble-leave-form-part-3" target="_blank">three</a>, where we introduced InfoPath 2007 and went through the exercise of importing the existing Springfield MSWord based form. We then added some data entry controls and tidied up the formatting. In <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4" target="_blank">part four</a>, we published this form to SharePoint itself.</p>
<p>All in all, the first four articles covered some pretty straightforward stuff. Now, however, the salesman has moved on and our intrepid engineer is starting to get into the pointy end of things. In <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">part five</a> we delved into the scary world of web services and InfoPath data connections so satisfy the requirement of automatic identification of the requestor. That was a bit of a jump, wasn&#8217;t it?</p>
<p>This time around, let&#8217;s take care of the &#8220;reduce data entry&#8221; requirement, and leverage some of InfoPath&#8217;s useful features to make our form smarter. For those who found <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">article 5</a> a bit heavy, this one is actually quite a bit easier (but it&#8217;s just a brief lull before we get to coding!). At the end of part 5 I said I&#8217;d deal with how to automagically handle the employee number &#8211; but I have decided to take care of that a little later.</p>
<h2>Preventing a rift in the space-time continuum</h2>
<p><em>Yeah, I know I was using the Simpsons theme for this series, but today I am dropping in a dash of Heroes.</em></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image2.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb2.png" border="0" alt="image" width="141" height="175" align="right" /></a>First up, we need to add some logic to the form so that it doesn&#8217;t submit crap (that&#8217;s the technical term for &#8220;invalid&#8221;) information. For example, we want to make sure that you cannot return to work on a date *before* you leave &#8211; unless you&#8217;re <a href="http://en.wikipedia.org/wiki/Hiro_Nakamura" target="_blank">Hiro Nakamura</a>, of course.</p>
<p>Generally, for the rest of us who cannot bend time, you do actually come back to work at some point *after* you leave, so let&#8217;s make the necessary changes to ensure that our form does not destroy the world in some space-time vortex.</p>
<p>Today we are interested in the three date/time fields as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image3.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb3.png" border="0" alt="image" width="466" height="86" /></a></p>
<p>If you recall in <a href="http://sharepointmagazine.net/technical/administration/a-tribute-to-the-humble-leave-form-part-3" target="_blank">part three</a> where we <a href="http://sharepointmagazine.net/technical/administration/a-tribute-to-the-humble-leave-form-part-3" target="_blank">created the form controls</a>, we gave them the meaningful names of CommenceDate, CompletionDate, ReturnDate.</p>
<p><em>For reference, at any time, you can review your field names easily by clicking the &#8220;Data Source&#8221; link in the InfoPath design pane as shown below.</em></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image31.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image31-thumb.png" border="0" alt="image" width="133" height="332" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image4.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb4.png" border="0" alt="image" width="188" height="329" /></a></p>
<p>So, we have these three date fields and the rules are:</p>
<ul>
<li>The completion date cannot be *before* the commencement date.</li>
<li>The return to work date cannot be *before* the completion date.</li>
</ul>
<p>When you think about what we are doing here, we are <strong>validating data </strong>to make sure that it matches our business rules. Fortunately for us, InfoPath has some nice capabilities here to assist. Even better, they called it &#8220;Data Validation&#8221;. So, let&#8217;s take a closer look&#8230;</p>
<ul>
<li>Select the &#8220;Completion Date&#8221; control, right click and choose &#8220;Data Validation&#8221;</li>
</ul>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image5.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb5.png" border="0" alt="image" width="345" height="301" /></a></p>
<p>You are presented with a fairly unexciting text box asking you to add a <strong>condition</strong> that determines whether the value entered is valid. Clicking the &#8220;Add&#8230;&#8221; button displays the dialog box to add a condition. <em>It is quite common to have multiple conditions that need to be satisfied in order for the data entered to be considered valid</em>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image6.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb6.png" border="0" alt="image" width="260" height="166" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image7.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb7.png" border="0" alt="image" width="387" height="165" /></a></p>
<p>In our case, we wish to ensure that the CompletionDate field cannot contain a value that is less than the CommenceDate field. Create this condition by specifying &#8220;less than&#8221; from the middle drop down box, and then picking the &#8220;CommenceDate&#8221; field for the third dropdown box.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image8.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb8.png" border="0" alt="image" width="293" height="138" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image9.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb9.png" border="0" alt="image" width="320" height="138" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image10.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb10.png" border="0" alt="image" width="224" height="257" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image11.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb11.png" border="0" alt="image" width="345" height="149" /></a></p>
<p>Clicking OK and we have our completed validation condition!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image12.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb12.png" border="0" alt="image" width="330" height="210" /></a></p>
<p>One final OK and we are back at our form and ready to test this. Rather than publish the form to SharePoint now, we can make use of InfoPath&#8217;s &#8220;Preview&#8221; button on the toolbar and test it out. Below I have an example preview where Homer has been identified as per the <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">previous post</a>. Additionally, I have used the date picker to specify the commencement date (October 25 2008) of leave.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image13.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb13.png" border="0" alt="image" width="445" height="258" /></a></p>
<p>What do you now see on the Completion Date field? What&#8217;s with that red asterix? Maybe I should hover my mouse over it and take a look, eh?</p>
<p>Aww&#8230; How sweet! A tooltip that matches the description I gave for this data validation condition. Well, what do you know? I spelt data instead of date (don&#8217;t worry I&#8217;ll fix it up later).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image14.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb14.png" border="0" alt="image" width="664" height="67" /></a></p>
<p>So, let&#8217;s try and defy time, then. I will enter October 24th as my return date. Doesn&#8217;t seem vary happy does it?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image15.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb15.png" border="0" alt="image" width="381" height="128" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image16.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb16.png" border="0" alt="image" width="387" height="68" /></a></p>
<p>But if I change the date to the 25th of October (therefore validating the rule we set up), InfoPath happily accepts the value.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image17.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb17.png" border="0" alt="image" width="392" height="64" /></a></p>
<h2>That it? That was easy!</h2>
<p>Yeah, it was very easy so what are you complaining about? <strong>Easy is good </strong>and there should be more of it!</p>
<p>We now need to do the same thing for the &#8220;Return to Work&#8221; form field. Essentially, we perform the very same steps and thankfully for the both of us, I am not going to smother you with screenshots. This is where you try it yourself and instead I will simply list the steps and one screenshot.</p>
<ol>
<li>Right click the ReturnDate field and choose Data Validation</li>
<li>Add a new validation condition where the ReturnDate is less than the CompletionDate</li>
<li>Add a tooltip text &#8220;Return date cannot be before the completion date&#8221;</li>
<li>Click OK twice and test using the preview button</li>
</ol>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image18.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb18.png" border="0" alt="image" width="398" height="171" /></a></p>
<h2>The published experience</h2>
<p>Now that we have successfully tested the validation rules for the date fields, let&#8217;s publish the form to SharePoint and see what it all looks like. I followed the exact publishing steps that I outlined in <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4" target="_blank">part 4</a>, so please refer to that article if you need a recap.</p>
<p>I navigated to the forms library as described in part 4 and created a new form.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>I then deliberately entered bad data into the form and sure enough, the data validation rules picked up on the issue. Excellent &#8211; Waylon Smithers is very pleased!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image85.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image85-thumb.png" border="0" alt="image" width="493" height="394" /></a></p>
<h2>Reviewing our progress&#8230;</h2>
<p>So, since we are about to see off part 6, our Project Manager wants to get a status update on how the Springfield leave form project is progressing. So, after 6 articles, what have we achieved? To remind you, the requirements were:</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the appropriate supervisor</li>
<li>We have a central leave calendar to update</li>
<p>Identification of Homer is now sorted, and we have taken steps both in the areas of reducing data entry and validating the dates (excluding days absent). So, we are tracking nicely and haven&#8217;t fallen behind schedule just yet <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>Before we continue with addressing all of these requirements, we will have to take a bit of a detour as I explain below.</p>
<h2>Too good to be true?</h2>
<p>Here&#8217;s a little experiment for you to try. On the above form, published in its current form with deliberately invalid dates (highlighted in red), you will see a toolbar that has a &#8220;Save&#8221;, &#8220;Save As&#8221;, &#8220;Close&#8221; and &#8220;Print View&#8221; on it. I clicked the Save As button and was dutifully prompted for a filename. I called the form &#8220;<strong>Homer&#8217;s Test Form</strong>&#8221; as shown below and clicked Save</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image20.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb20.png" border="0" alt="image" width="343" height="229" /></a></p>
<p>I then closed the form and checked out the form library on the <a href="http://radioactivenet">http://radioactivenet</a> site. What the&#8230;! It saved it! What&#8217;s the point of data validation if you can just save the form anyway?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image21.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb21.png" border="0" alt="image" width="565" height="149" /></a></p>
<p>The answer to that question, my friends, is there is a difference between saving a form and <strong>submitting</strong> a form. But you will have to wait for part 7 of this series for that riveting discussion!</p>
<p>Thanks for reading</p>
<p>Paul Culmsee</p>
<p><a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></p>
<p><a href="http://www.sevensigma.com.au">www.sevensigma.com.au</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A humble tribute to the leave form &#8211; Part 5</title>
		<link>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5</link>
		<comments>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5#comments</comments>
		<pubDate>Fri, 03 Oct 2008 07:40:47 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Help]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=600</guid>
		<description><![CDATA[Welcome again students to part 5 of the CleverWorkArounds Institute Body of Knowledge (CIBOK). As you know, the highly prestigious industry certification, the CleverWorkarounds Certified Leave Form Developer (CCLFD) requires candidates to demonstrate proficiency in all aspects of vacation/leave forms. Parts 1-4 of this series covered the introductory material, and now we move into the more advanced topic areas.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb.png" border="0" alt="image" width="159" height="156" align="left" /></a>Welcome again students to part 5 of the CleverWorkArounds Institute Body of Knowledge (CIBOK). As you know, the highly prestigious industry certification, the <strong>CleverWorkarounds Certified Leave Form Developer </strong>(CCLFD) requires candidates to demonstrate proficiency in all aspects of vacation/leave forms. Parts 1-4 of this series covered the introductory material, and now we move into the more advanced topic areas.</p>
<p>Wondering what the hell I am talking about? Perhaps you&#8217;d better <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4">read part 4</a>.</p>
<p>This post represents a change of tack. the first four articles were written from the point of view of demonstrating InfoPath in a pre-sales capacity. Your &#8220;business development managers&#8221;, which is a politically correct term for &#8220;steak-knife salesmen&#8221;, have promised the clients that InfoPath is so good that it can also make your coffee too. Essentially, anything to make the sale and earn their commission. Of course, they don&#8217;t have to stick around to actually implement it. They have moved off onto their next victim, and you are left to satisfy the lofty expectations.</p>
<p>Now, we switch into &#8220;implementation engineer&#8221; mode where a proof of concept trial has been agreed to. At this point we are dealing with three client stakeholders. Monty Burns (project sponsor), Waylon Smithers (process owner) and Homer Simpson (user reference group).</p>
<p>To remind you about parts one to four, we introduced the leave form requirements, and demonstrated how quick and easy it is to create a web based InfoPath form and publish it into SharePoint with no programming whatsoever. Was it a realistic demo? Of course not! But we have sold the client the dream and now we have to turn that dream into reality!</p>
<p>Here are the original requirements.</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the right supervisor</li>
<li>We have a central leave calendar to updateSo in this article, we will deal with the first requirement.<br />
<h2>Automatic Identification of Homer</h2>
<p>Now, some of the staff of the Springfield Nuclear Power aren&#8217;t the most computer literate. Technical support staff report that one employee in particular, Homer Simpson, is particularly bad. In between sleeping on the job and chronic body odour, he has been known to hunt in vain for the &#8220;any&#8221; key on the keyboard. So he was chosen to be the user acceptance test to ensure that the entire process is completely idiot-proof.</p>
<p>The way we will do this is to automatically fill in the <strong>full name</strong> of the current user, so Homer will not have to type his name in. It would just automagically appear as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image1.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb1.png" border="0" alt="image" width="677" height="54" /></a></p>
<p>So our process owner, Waylon Smithers, is excited and expectantly asks you, &#8220;This is easy to do, right&#8221;?</p>
<p>&#8220;Sure&#8221;, you answer confidently. &#8220;It&#8217;s built into InfoPath and I do it all the time&#8221;.</p>
<p>You then proceed into the properties of the above &#8220;Employee Name&#8221; textbox and locate the &#8220;Default Value&#8221; textbox. You then click the magical &#8220;fx&#8221; button that lets you pick from a bunch of built-in functions as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image2.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb2.png" border="0" alt="image" width="398" height="231" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image3.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb3.png" border="0" alt="image" width="354" height="230" /></a></p>
<p>Now anybody who has used Excel will be used to the notion of using built-in functions to create dynamically created values. InfoPath provides similar cleverness. There are formulas for mathematical equations, string manipulation, date and time functions as well as a bunch of others.</p>
<p><em>While I won&#8217;t be discussing every built-in function in this article, I encourage you to check out what is available.</em></p>
<p>Now our intrepid consultant already knows what formula they want to use. The &#8220;Insert Function&#8221; button is clicked and from the list of functions available (conveniently categorised by type), we choose the function userName as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image4.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb4.png" border="0" alt="image" width="400" height="273" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image5.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb5.png" border="0" alt="image" width="337" height="218" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image6.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb6.png" border="0" alt="image" width="398" height="237" /></a></p>
<p>So we have now set the default value for the &#8220;Employee Name&#8221; field to be whatever the data the userName() function decides to give us. So let&#8217;s see what our favourite employee Homer Simpson now sees.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image7.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb7.png" border="0" alt="image" width="536" height="175" /></a></p>
<p>&#8220;Voila&#8221;, you think to yourself. &#8220;Homer, please test it.&#8221;</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image8.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb8.png" border="0" alt="image" width="179" height="244" /></a></p>
<p>Homer: &#8220;Herrrrrr Simmmmmpson. Mmmmm. Who is hersimpson&#8221;?</p>
<p>Consultant: &#8220;Who&#8221;?</p>
<p>Homer: &#8220;Hersimpson. Is that&#8230; Lenny?&#8221;</p>
<p>Consultant: &#8220;&#8230;&#8221;</p>
<p>Homer: &#8220;Oh, wait! I know! I know! It&#8217;s that new sprinkled donut &#8230; mmmm donuts&#8230;.&#8221;</p>
<h2>Making it Homer Proof</h2>
<p>So, it seems we have a problem at the user acceptance testing phase. Apart from drifting off into a donut induced daydream, it is clear that showing the username is not a good idea as Homer has not realised that his userid (hsimpson) represents himself. Clearly it would be more &#8220;Homer friendly&#8221; if his full name was displayed instead.</p>
<p>At this point, we hit our first InfoPath challenge. How do we get the full name? We have no built in function called &#8220;fullName()&#8221;, so how can we do it?</p>
<p>Hmm, this is a little tougher than everything we have done so far. Perhaps we should get in some additional help.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image9.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb9.png" border="0" alt="image" width="72" height="117" align="left" /></a></p>
<p>&#8220;Well it&#8217;s quite simple, really. We need to create a secondary data source to the SharePoint web service UserProfileService.asmx and call the GetuserprofileByName method, passing it a blank string parameter called AccountName, and then interrogate name value pairs in the response to grab the first and last name and concatenate them into a full name Mm-hai.&#8221;</p>
<p>Does anybody want the non-nerd (English) version of the above sentence? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Given that lots of interesting &#8220;stuff&#8221; lie buried in various applications, databases, files and other &#8220;systems&#8221;, the designers of InfoPath were well aware that they had to make InfoPath capable of accessing data in these systems. In doing so, electronic forms can reduce duplication, data entry and leverage already entered (and hopefully, sanitised and verified) data.</p>
<p>One of the many different methods of accessing &#8220;stuff&#8221; is via <strong>&#8220;web services&#8221;</strong>. The easiest way to think about web services is to think about Google. When you place a search on Google for say, &#8220;teenyboppers&#8221;, your browser is making a request to google servers to return &#8220;stuff&#8221; that relates to your input. In this case, people who actually like Brittany Spears&#8217; songs.</p>
<p>Google is in effect providing a <strong>service</strong> to you and the protocol that drives the world wide web (HTTP) is the <strong>transport mechanism</strong> that both parties rely on.</p>
<p>So, a real-life web service is really just a more sophisticated version of this basic idea. One program can chat to another program by &#8220;talking&#8221; to its web services over HTTP. In this way, two systems can be on the other side of the world, yet be able to communicate with each-other and provide each-other with data and, well &#8230; services!</p>
<p>SharePoint is no exception, and happens to have a bunch of web services that allow programs to &#8220;talk&#8221; to it in many different ways. I am not going to list them all here, but it just so happens that one of those web services, gives us just what we need &#8211; the full details of the currently logged-in user. So we are going to get InfoPath to &#8220;call&#8221; this particular web service and return to us the data we need to make Homer happy.</p>
<h2>Okay in theory but&#8230;</h2>
<p>Now hopefully the basic idea of webservices now makes sense. Actually making the leap to using them does take some learning. Since this is all over HTTP, a web service is simply a website URL.</p>
<p><em>Real programmers &#8211; don&#8217;t start getting all anal with me about definitions here. This explanation is for people who speak human! </em></p>
<p>The URL of the SharePoint web service that we want is this:</p>
<p>http://&lt;address of sharepoint site&gt;/_vti_bin/UserProfileService.asmx</p>
<p>eg</p>
<p><a href="http://radioactivenet/_vti_bin/UserProfileService.asmx">http://radioactivenet/_vti_bin/UserProfileService.asmx</a></p>
<p>If you point your browser to this URL, you will get a response back, listing all of the various &#8220;methods&#8221; that this web service provides (click to enlarge). The screenshot below is not exhaustive, but the point is that one web service can actually provide <strong>many functions</strong> (generally known as methods) to perform all sorts of tasks.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image10.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb10.png" border="0" alt="image" width="244" height="186" /></a></p>
<p>Now, InfoPath likes to make things nice and wizard-based, and all of these above methods operate differently. Some take parameters (I.e. to create a new user account via web service you would have to supply details like name, password and the like). Some do not need parameters but return multiple values while some return a single value. Others still return different values based on parameters that you send to the method.</p>
<p>How can InfoPath possibly know in advance what it needs to send to/receive from our selected method? Fortunately the geeks thought of this and invented an extremely boring language called Web Services Definition Language (or <a href="http://www.w3.org/TR/wsdl" target="_blank">WSDL</a> for short). All you need to know about WSDL is that apart from being a fantastic cure for insomnia if you ever read it, it provides a way for applications, like InfoPath, to <strong>find out</strong> what it needs to do, to interact with a particular method.</p>
<p>So, using the above web service again, we will actually ask the web service to tell InfoPath all about itself using WSDL by slightly changing the URL as illustrated below</p>
<p><a href="http://radioactivenet/_vti_bin/UserProfileService.asmx?WSDL">http://radioactivenet/_vti_bin/UserProfileService.asmx?WSDL</a></p>
<p>Now, if you try that in a browser you see all sorts of XML crap <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image11.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb11.png" border="0" alt="image" width="244" height="141" /></a></p>
<p>But don&#8217;t worry, you will never have to actually look at it again &#8211; InfoPath digs it &#8211; and that&#8217;s all you need to know.</p>
<h2>InfoPath Data Sources and Data Connections</h2>
<p>Now, it is time to actually get InfoPath to talk to this &#8220;UserProfileService&#8221; web service as described above.</p>
<p>As I said, Web services is one several sources of data that InfoPath can access from. First up, we need to make a connection to a data source (imaginatively called Data Source connections).</p>
<p>From the tools menu, choose &#8220;Data Connections&#8221; and a dialog box asks you to some information about the sort of data connection that we want to use. We wish to <strong>receive </strong>Homer&#8217;s details from the web service, so we choose to receive data and choose &#8220;Web Service&#8221; as the source of our data.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image12.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb12.png" border="0" alt="image" width="226" height="208" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image13.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb13.png" border="0" alt="image" width="412" height="121" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image14.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb14.png" border="0" alt="image" width="244" height="162" /></a></p>
<p>We are next asked for the URL of the web service. We pass it the URL of http://radioactivenet/_vti_bin/UserProfileService.asmx?WSDL</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image15.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb15.png" border="0" alt="image" width="398" height="109" /></a></p>
<p><em>Note: This really should be the <strong>exact</strong> sub-site where the InfoPath form was published to. So, if say, this form was to be published into a sub site called HR, then the URL would be http://radioactivenet/HR/_vti_bin/UserProfileService.asmx?WSDL. </em></p>
<p>Clicking NEXT and you are presented with the various methods that this web service provides. The method that we are going to use is &#8220;GetUserProfileByName&#8221;. We choose it and click &#8220;Next&#8221;.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image16.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb16.png" border="0" alt="image" width="506" height="339" /></a></p>
<p>At this point, we really start diving deep into talking to web services. InfoPath examines the details of this method by looking at the WSDL information. It determines that this particular method (GetUserProfileByName) expects a parameter to be passed to it called &#8220;AccountName&#8221;. We are prompted to supply a value for &#8220;AccountName&#8221;. Fortunately for us, if we do not supply a parameter here, then the web service will use the account name of <strong>the currently logged in user</strong>! This is exactly what we want. This method will automatically use the username of the current person without us having to manually specify it.</p>
<p>Thus, we can leave this screen as is and click NEXT. The final message asks if we wish to connect to the web service now to retrieve data, but in this case we do not.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image17.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb17.png" border="0" alt="image" width="415" height="148" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image18.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb18.png" border="0" alt="image" width="372" height="98" /></a></p>
<p>We have now finished configuration. We are asked to save this connection and give it a name. (As you can see below the name defaults to the method name, so we will leave it unchanged. We also tick the box to connect to the data source as soon as the form is opened).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image19.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb19.png" border="0" alt="image" width="423" height="280" /></a></p>
<h2>Using the data connection</h2>
<p>We have an InfoPath data connection to this web service. Now what?</p>
<p>Well, let&#8217;s go back to our employee name text box and change the default value to something returned by the web service method GetUserProfileByName. As we did earlier, we click the function button, but this time we are not doing to add a function. We will instead use the &#8220;Insert Field or Group&#8221; button.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image2.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb2.png" border="0" alt="image" width="398" height="231" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image3.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb3.png" border="0" alt="image" width="354" height="230" /></a></p>
<p>By default, InfoPath has a &#8220;main&#8221; Data source, which is the form itself. We now have to tell InfoPath that the default value for the employee name is going to come from a different data source. On the data source drop down, choose secondary data source called &#8220;GetUserProfileByName&#8221; from the drop down as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image20.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb20.png" border="0" alt="image" width="262" height="298" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image21.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb21.png" border="0" alt="image" width="262" height="298" /></a></p>
<p>Notice that the fields available to choose for the GetUserProfileByName datasource looks very different to the main datasource. This is because the web service returns data in a particular format, and it is now up to us, to interrogate that format to get the information we want.</p>
<p>The GetUserProfileByName method returns a whole bunch of user profile values, way more than the stuff we specifically want. It returns these details in a name/value format as shown below:</p>
<table border="1" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td width="200" valign="top"><strong>Name</strong></td>
<td width="200" valign="top"><strong>Value</strong></td>
</tr>
<tr>
<td width="200" valign="top">FirstName</td>
<td width="200" valign="top">Homer</td>
</tr>
<tr>
<td width="200" valign="top">Lastname</td>
<td width="200" valign="top">Simpson</td>
</tr>
<tr>
<td width="200" valign="top">Office</td>
<td width="200" valign="top">Sector 7G</td>
</tr>
<tr>
<td width="200" valign="top">Title</td>
<td width="200" valign="top">Safety Inspector</td>
</tr>
</tbody>
</table>
<p>&#8230; and another 42 more name/value pairs like the above!</p>
<p>So we will have to tell InfoPath to examine the full list of &#8220;Values&#8221;, and find the <strong>specific value for &#8220;FirstName&#8221;. </strong></p>
<p><em>Note that firstname and lastname are <strong>separate items</strong>. There is no property called &#8220;FullName&#8221;. We will deal with this a little later.</em></p>
<p><em>Now although telling InfoPath to filter the user profile information is achieved using a wizard, it is not the most intuitive process. Once you have done it a few times, it becomes second nature. But be warned &#8211; you may be about to suffer death by screenshot&#8230;</em></p>
<p>Recall in the last screenshot we were looking at the data returned by the web service method called GetUserProfileByName. We need to <strong>filter </strong>the 46+ possible profile values to the specific one we need. Now you know what that &#8220;Filter Data&#8230;&#8221; button does <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>From the list of fields returned by this method, choose &#8220;Value&#8221; and click &#8220;Filter Data&#8221;.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image22.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb22.png" border="0" alt="image" width="215" height="244" /></a></p>
<p>We have now told InfoPath that we want one of the &#8220;value&#8221; fields, but we need to filter it to the specific value that we need. That value is &#8220;FirstName&#8221;. So in effect we are saying to InfoPath &#8220;give me the value for the property where the property called <strong>Name </strong>= &#8220;FirstName&#8221;. The sequence of screenshots below shows how I tell Infopath to use the Name field as the filter field.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image23.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb23.png" border="0" alt="image" width="492" height="205" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image24.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb24.png" border="0" alt="image" width="213" height="244" /></a></p>
<p>Now we have to set name to equal the property name &#8220;FirstName&#8221;. The next two screenshots show this.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image25.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb25.png" border="0" alt="image" width="499" height="143" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image26.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb26.png" border="0" alt="image" width="508" height="117" /></a></p>
<p>Click OK and you now have your formula as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image27.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb27.png" border="0" alt="image" width="349" height="228" /></a></p>
<p>Click a zillion other &#8220;OK&#8221; buttons and you will be back at your form in design mode. Clicking the &#8220;Preview&#8221; button and check the Employee name field. Wohoo! It says &#8220;Homer!&#8221;</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image28.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb28.png" border="0" alt="image" width="505" height="173" /></a></p>
<h2>But I said &#8220;full name&#8221; not &#8220;first name&#8221;&#8230;</h2>
<p>So, that&#8217;s great. Although connecting to a web service and telling it to retrieve the correct data is tricky and requires some training, no custom programming code was written to do this. But alas, poor old Homer still get&#8217;s a little confused and we wish to see the <strong>full name </strong>of the person filling in the form.</p>
<p>Fortunately, this is actually quite easy. We just need to grab the FirstName <strong>and </strong>the LastName values from the web service and then join them together.</p>
<p>I demonstrate this below (with an adjusted formula &#8211; for the sake of article length I&#8217;ve not added the screenshots used to create this formula. I am hoping that I gave you enough to figure it out for yourself).</p>
<p>Application developers or Excel people will quickly see that I have retrieved the &#8220;LastName&#8221; value using the exact same method described in the last section for the &#8220;FirstName&#8221; value. I then used the built-in function concat (concatenate) to join FirstName and LastName together (with a space in between).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image29.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb29.png" border="0" alt="image" width="360" height="235" /></a></p>
<p>Let&#8217;s now preview the form&#8230; Wohoo!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image30.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb30.png" border="0" alt="image" width="543" height="163" /></a></p>
<p>So, just to be completely sure, we republish the form, following the steps in part 4 and examine the form in the browser to make sure that it works there as well.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image31.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb31.png" border="0" alt="image" width="554" height="378" /></a></p>
<h2>Conclusion (and further notes)</h2>
<p>So amazed at your ingenuity, you have managed to get InfoPath to retrieve the details it required so that the user did not have to fill in their name manually. There was certainly a lot more to it than using a built-in InfoPath function, and (for the first time anyway), probably took you a little while. But the main thing is, you have satisfied the first requirement and Waylon Smithers is now happy. He is a little bewildered in all the low-level web service stuff and concerned about how easy it would be for some of his staff to create forms, but regardless, everything was performed via the InfoPath graphical user interface.</p>
<p>So in the next post, we will look at two ways we can deal with the automatic retrieval of the employee number.</p>
<p>Thanks for reading</p>
<p>Paul Culmsee</p>
<p><em>P.S: Do not attempt to explain the low level details of pulling values from a web service in a presales demo <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</em></li>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A tribute to the humble &#8220;leave form&#8221; &#8211; Part 4</title>
		<link>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4</link>
		<comments>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4#comments</comments>
		<pubDate>Thu, 11 Sep 2008 08:00:10 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Help]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[leave]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=308</guid>
		<description><![CDATA[Hi again. Welcome to part 4 of my tribute to the "leave form". It's probably time to just get straight into the article, as I think the whole leave form joke isn't overly funny anymore :-)]]></description>
			<content:encoded><![CDATA[<p>Hi again. Welcome to part 4 of my tribute to the &#8220;leave form&#8221;. It&#8217;s probably time to just get straight into the article, as I think the whole leave form joke isn&#8217;t overly funny anymore <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Crap, there is probably going to be a dozen or so articles and I&#8217;m running out of jokes already?</p>
<p>But then I suddenly remembered that in this certification obsessed IT world we live in, I could make up my very <em>own</em> certification! I mean how hard can it be? Just add the word &#8220;institute&#8221; to your name and your legitimate right?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/cwabadge.jpg"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/cwabadge-thumb.jpg" border="0" alt="CWAbadge" width="385" height="377" /></a></p>
<p>Therefore I am pleased to unveil the first of a series of certifications to be offered by the CleverWorkarounds Institute and its associated body of knowledge (CIBOK). The <strong>CCLFD</strong> or <strong>CleverWorkarounds Certified Leave Form Developer </strong>certification, which allows certified practitioners the opportunity to feel vastly superior to the mere mortals they work with. Additionally, it has waaaay more bragging rights than one of those weenie certifications like MSCE or CISSP. Of course, like all acronyms to add to your business card, you are certainly guaranteed a big, fat pay rise.</p>
<p>So what someone wants to validate your credentials, you just flash the badge below and they will all be like&#8230;&#8221;wow, this dude is a business process <strong>god</strong>!&#8221;</p>
<h2>SharePoint Pre-Requisites</h2>
<p>Right enough banter and back to business! Now remember, we are in &#8220;Business Development Manager&#8221; mode in this post and therefore we are trying to impress here. Selling the client the message that the you will solve all organisational process issues (and find the answer to world peace) in InfoPath and Forms Services. So far, we have fairly quickly produced a usable InfoPath form. All in all it has taken maybe 10-15 minutes of demo time. So in the interests of &#8220;impress the client at all costs&#8221;, we have done enough to publish it straight into SharePoint, so that it is usable via a web browser.</p>
<p>That CCLFD certification is looking good yes? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So first up, we need a SharePoint site to publish the site to. But not just *any* SharePoint server. It needs to be running the <strong>enterprise licence </strong>if you wish to use InfoPath Forms Services.  So sorry stingy people, WSS and Office SharePoint Server 2007 Standard Edition will <strong>not</strong> suffice.</p>
<p><em>Now if this were a demo, I would have already had this set-up in advance to make the client &#8220;ohhh&#8221;, &#8220;aaah&#8221;, &#8220;wooow&#8221; louder. But I think it is worth examining the prerequisites in more detail.</em></p>
<p>Assuming that the SharePoint farm been built and a web application has been created (called <a href="http://radioactivenet">http://radioactivenet</a>), it is time to create a brand new site collection to host this form. The SharePoint farm administrator performs this task in Central Administration -&gt; Application Management. In this example, we are creating a completely blank SharePoint site.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image44.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb42.png" border="0" alt="image" width="298" height="338" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image45.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb43.png" border="0" alt="image" width="285" height="202" /></a></p>
<p>Have we done enough to publish our form to SharePoint? Unfortunately, not quite. In fact if we tried to publish our leave form into the site as it is now, we would have a little warning message that easy to overlook and then cause you no end of wasted time.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image46.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb44.png" border="0" alt="image" width="518" height="73" /></a></p>
<p>But I am getting ahead of myself. Having created this new site collection above, we now need to enable the <strong>enterprise feature-set </strong>that includes the forms services component that we need. For the purposes of this post, I will not be explaining the SharePoint feature framework, but for the uninitiated, SharePoint is like a fisher-price toy with lots of buttons that have different effects when pushed. (We haven&#8217;t yet pushed the right button). <em>Think about SharePoint site templates (e.g Document Workspace, Wiki Site) as automatically pressing the buttons for you. </em></p>
<p>To activate the enterprise featureset, we log into <a href="http://radioactivenet">http://radioactivenet</a> as an administrator or site collection administrator. Choose the &#8220;Site Actions&#8221; drop down menu below the search box. Choose &#8220;Site Settings&#8221; and you will be taken to the administrative back-end of a SharePoint site collection. I have highlighted the option to control site collection features. (Click to zoom)</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image47.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb45.png" border="0" alt="image" width="323" height="157" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image48.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb46.png" border="0" alt="image" width="393" height="56" /></a></p>
<p>This screen shows you all of the nice buttons to push. The one that we need for this demonstration is the &#8220;Office SharePoint Server Enterprise Site Collection Features&#8221;. Simply the click &#8220;Activate&#8221; and you are done!</p>
<h2>Finally, let&#8217;s publish it already!</h2>
<p>To remind you all of where we got to at part 3, we have a functional form looking like this. (Click to expand)</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image49.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb47.png" border="0" alt="image" width="244" height="148" /></a></p>
<p>Publishing an InfoPath form into SharePoint is based on a Wizard. We want to impress here, so we will do a straightforward form publication. Start the wizard by choosing &#8220;Publish&#8221; from the &#8220;File menu&#8221;. The first wizard screen will ask you *where* you wish to publish to. Obviously we go with the default answer of SharePoint <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image50.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb48.png" border="0" alt="image" width="244" height="216" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image51.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb49.png" border="0" alt="image" width="439" height="120" /></a></p>
<p>Next we are asked to specify which SharePoint site we would like to deploy this new form to. We are using our newly created <a href="http://radioactivenet">http://radioactivenet</a> site.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image52.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb50.png" border="0" alt="image" width="439" height="132" /></a></p>
<p>Now we hit the first important step in the whole process. This is the step where InfoPath publishing wizard asks you to <strong>how</strong> to publish this form. While I am not going to explain each option in detail at this stage, I will warn you now that we are going to come back to this screen in subsequent posts.</p>
<p>Notice how &#8220;Enable this form to be filled out by using a browser&#8221; is checked? This is because this InfoPath form that we created has been set to be &#8220;browser compatible&#8221; way back in part 2 when we first created the form template.</p>
<p>The first and default choice is to create the form in a SharePoint Document Library. Thus in the SharePoint world, InfoPath forms are just another type of library storage. therefore you can can use version history, recycle bin and all of the other goodies that come with SharePoint document libraries. Now I should make it clear though, that SharePoint creates a special type of library called a &#8220;Form Library&#8221;, designed specifically for InfoPath forms. So we leave &#8220;Document Library&#8221; chosen as the default and click continue on.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image53.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb51.png" border="0" alt="image" width="425" height="203" /></a></p>
<p>Having chosen to use a document library we are now asked to create a new one or choose an existing library. In our case, we have not yet created the library to hold the leave form, so we choose to &#8220;Create a new document library&#8221; and then enter it&#8217;s name and description into the follow-up dialog box. This will create a form library called &#8220;Leave Forms&#8221; for us as part of the publishing process.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image54.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb52.png" border="0" alt="image" width="369" height="127" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image55.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb53.png" border="0" alt="image" width="283" height="124" /></a></p>
<p>The next step is another important one. But in the interests of our &#8220;impress the client at all costs&#8221; focus, we are going to leave it until the next post. So we click Next to continue.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image56.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb54.png" border="0" alt="image" width="548" height="172" /></a></p>
<p>That&#8217;s it for the publishing process! Clicking the Publish button will commence the process. InfoPath will create the form library and when it finished provide us with a summary of what has been performed as shown below. You can see the name of the library where the form was published (&#8220;Leave Forms&#8221;), the URL of the SharePoint site (<a href="http://radioactivenet/leave">http://radioactivenet/leave</a> forms) and the fast that Infopath Forms services is running on the server.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image57.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb55.png" border="0" alt="image" width="546" height="220" /></a></p>
<h2>The new form library</h2>
<p>So, are we ready to &#8220;wow&#8221; the client yet? Almost!</p>
<p>Looking at the <a href="http://radioactivenet">http://radioactivenet</a> site, we can now see that we have a new content item in the navigation. Well what do you know? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  It&#8217;s a leave form library!!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image58.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb56.png" border="0" alt="image" width="502" height="346" /></a></p>
<p>If you navigate to this document library, you will see that it pretty much looks like any other SharePoint document library. Clicking the New drop down in the document library though shows that something is subtly different with this library. The document type to create has the InfoPath symbol on it. This library <strong>knows</strong> that it is here to store InfoPath forms.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>But there is one minor catch. By default, SharePoint assumes that if you have InfoPath installed on your PC, then you will always prefer to use InfoPath in preference to a more limited, somewhat &#8220;clunkier&#8221; web based version. In our case, we want the form to show up in a browser, irrespective or whether InfoPath is installed on you PC. So let&#8217;s do that now.</p>
<p>In the new Leave Forms library, we choose &#8220;Form Library Settings&#8221; from the &#8220;Settings&#8221; drop down menu as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image60.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb58.png" border="0" alt="image" width="340" height="169" /></a></p>
<p>Now remember how I said that a forms library is a document library geared especially to host InfoPath forms? Well, now you get to see why. One of the configuration options unique to a forms library is whether to display a form in a browser or using InfoPath. The option controlling this can be found in &#8220;Advanced Settings&#8221; as highlighted below. The third option under advanced settings controls the behaviour for &#8220;browser enabled&#8221; documents. Note that the default option is to &#8220;Open in the client application&#8221;.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image61.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb59.png" border="0" alt="image" width="302" height="182" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image62.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb60.png" border="0" alt="image" width="329" height="261" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image63.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb61.png" border="0" alt="image" width="478" height="81" /></a></p>
<p>So let&#8217;s change this to &#8220;Display as a web page&#8221; and click OK. Also note the second option, &#8220;Document Template&#8221;. We will be talking about this a subsequent post as well.</p>
<h2>The big test!</h2>
<p>So, all is now in place and it is time to demonstrate the functionality to your eager and excited clients. Go back to the home page of <a href="http://radioactivenet">http://radioactivenet</a> and choose &#8220;Leave Forms&#8221; from the navigation bar. In the document library view, choose &#8220;New Document&#8221; from the &#8220;New&#8221; drop down.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>Wohoo! The form renders in the browser! (and the crowd goes wild! <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image64.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb62.png" border="0" alt="image" width="572" height="430" /></a></p>
<h2>Conclusion</h2>
<p>So there you go, in something like 20-25 minutes, you have created and published a web based form that started life as a MSWord template. Highlighting how long this world have taken to be custom developed, your client is already writing a cheque and wants you to do this with all of their internal forms right???</p>
<p>Whatsmore, we haven&#8217;t even gotten to the unbridled joy that is a workflow yet! Oh man if the client likes forms services, they ain&#8217;t seen nothin&#8217; yet right???</p>
<p>Well, to be honest, this form really isn&#8217;t that smart yet is it? Before we even get to workflow considerations, the form still isn&#8217;t *that* friendly and we haven&#8217;t yet satisfied several of the requirements outlined in <a href="http://sharepointmagazine.net/technical/development/a-tribute-to-the-humble-leave-form" target="_blank">part 1</a>. Remember that we had to provide:</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the right supervisor</li>
<li>We have a central leave calendar to updateSo in the next post, we will make this form a little smarter and see if it is still within the realms of mere mortals (non developers) to do.thanks for readingPaul Culmsee<a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></li>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4/feed</wfw:commentRss>
		<slash:comments>6</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>
		<item>
		<title>A tribute to the humble &#8220;leave form&#8221; &#8211; Part 2</title>
		<link>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-2</link>
		<comments>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-2#comments</comments>
		<pubDate>Sat, 12 Jul 2008 13:49:05 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Help]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[bpm]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[infopath sharepoint workflow process]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=74</guid>
		<description><![CDATA[Hi again and welcome to the next exciting instalment in the series that pays tribute to the consultant "get out of jail free" card that is the organisational "leave form".]]></description>
			<content:encoded><![CDATA[<p>Hi again and welcome to the next exciting instalment in the series that pays tribute to the consultant &#8220;get out of jail free&#8221; card that is the organisational &#8220;leave form&#8221;. My experience of SharePoint implementations may be somewhat skewed by regional and/or cultural bias of course, but many SharePoint installations tend to follow a script of something like</p>
<ul>
<li>IT Manager attends an &#8220;information session&#8221; from a Microsoft Gold Partner, has one two many chardonnays and is convinced that SharePoint is the *answer*, but isn&#8217;t sure of the question just yet&#8230;</li>
<li>IT Manager calls aforementioned Microsoft Gold Partner and I am sent out to dazzle them with my wit, charm and technical brilliance</li>
<li>IT Manager agrees with me that SharePoint has to be sold to (and owned by) &#8220;the business&#8221;, so chooses the first candidate business process that pops into his head</li>
<li>All hail the mighty &#8220;<strong>leave form</strong>&#8220;</li>
</ul>
<p>Me sarcastic? never! <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/getoutofjailcopy21.jpg"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/getoutofjailcopy21-thumb.jpg" border="0" alt="getoutofjail copy (2)" width="339" height="193" /></a></p>
<p><em>Note: I was recently certified as a Microsoft Certified Trainer for SharePoint, and I am using this series as practice for my training material! Thus this entire series of articles is pitched at a very high (end user) level. Readers with some exposure to SharePoint may find this article from the series is particularly easy-going, but rest assured, by the time I am done, I will be delving into web services, code and all sorts of goodies. Writing that stuff for the non developer will be a challenge &#8211; so stay with me, I will slowly ramp up the concepts as we go on.</em></p>
<p>So to recap the <a href="http://sharepointmagazine.net/technical/development/a-tribute-to-the-humble-leave-form" target="_blank">introductory article</a>, we have documented the leave application and approval process for the Springfield nuclear power plant, and they have kindly supplied us with their existing leave form that their employees print out and fill in by hand. So our very first job is to see how InfoPath handles importing this MSWord based form to InfoPath.</p>
<h2>InfoPath 101</h2>
<p>Even though InfoPath is part of MSOffice, many people do not know about it, let alone used it. If you have never seen InfoPath before now, then I suggest you do some <a href="http://office.microsoft.com/en-au/infopath/default.aspx" target="_blank">reading</a> about it and maybe even download the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=2D1189BF-D86A-4ACF-9DCC-4D61F500AD6D&amp;displaylang=en" target="_blank">evaluation</a>.  My one sentence explanation is that it <strong><em>allows you to create electronic forms for data entry or data collection</em></strong>. Among its features is that it can import Word or Excel documents to speed up the form creation process. So let&#8217;s do that first up.</p>
<p>Upon starting up InfoPath 2007 we are presented with a &#8220;Getting Started&#8221; wizard. Our job is to design a new form, so the option to choose is to Design a Form Template as marked in the screen-grab below.</p>
<p>The next screen is to choose various options in relation to designing a form. We are starting from a completely blank form (which is the default option anyway), but this form is going to web browser based, so that people filling it in do not need InfoPath installed on their PC&#8217;s. SharePoint enterprise edition provides support for browser based forms via the &#8220;Forms Services&#8221; feature. InfoPath 2007 has built-in support for forms services, but the form must be marked as &#8220;browser compatible&#8221;.</p>
<p>This is not a default setting, so be sure to check the &#8220;Enable browser-compatible features only&#8221; box before clicking the OK button.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image7.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb7.png" border="0" alt="image" width="359" height="282" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image8.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb8.png" border="0" alt="image" width="455" height="280" /></a></p>
<p>Now we are at the main form designer screen within InfoPath. Being part of the MSOffice suite, it has a set of toolbars that looks very much like the other applications in the MSOffice suite. To the right of the InfoPath screen is the &#8220;design tasks&#8221; tool pane. I&#8217;ve shown it below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image31.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image31-thumb.png" border="0" alt="image" width="133" height="332" /></a></p>
<p>You will come to know the &#8220;design tasks&#8221; pane very well soon enough. From here we can perform all sorts of actions to construct a new electronic form such as create textboxes, buttons, drop down lists and the like. Not only that, but we can instruct InfoPath to connect to &#8220;data sources&#8221; to populate the values in say, a drop down list box. Imagine for example that all of your clients are listed in your CRM system. InfoPath has the capability to access those client details and display them on the form. Think of the data entry duplication that this will save,  not to mention the  maintenance of data accuracy, eh?</p>
<p>But hey, we are here to impress the clients with our technical wizardry and to show how InfoPath allows non-developers to create sophisticated electronic forms. So what we will do first-up is import the existing MSWord based leave document and see what we get out of the box.</p>
<h2>Importing the old form</h2>
<p>So, you should be at the main InfoPath screen to perform this action. From the &#8220;File&#8221; menu, choose &#8220;Import Form&#8221;. On the next screen, choose &#8220;InfoPath importer for Word documents&#8221; and click &#8220;next&#8221;</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image10.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb10.png" border="0" alt="image" width="209" height="244" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image11.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb11.png" border="0" alt="image" width="377" height="242" /></a></p>
<p>You will be prompted to browse to a file to import. In this example, I have chosen the &#8220;springfieldleaveform.doc&#8221;. The &#8220;options&#8221; button allows you to control the specifics of the import process. In this example, I will simply import the form with all of the default import settings.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image12.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb12.png" border="0" alt="image" width="482" height="310" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image13.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb13.png" border="0" alt="image" width="234" height="311" /></a></p>
<p>Click &#8220;Finish&#8221; and InfoPath will do its thing &#8211; viola! We have the beginnings of a leave form!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image14.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb14.png" border="0" alt="image" width="488" height="364" /></a></p>
<h2>Graphics?</h2>
<p>Ah, but wait, what happened to the graphics? The original MSWord form had two pictures in the header of the document &#8211; a 3-eyed fish and a picture of the towers. It turns out it seems, that graphics in the header or footer of an MSWord document do not get imported into InfoPath. Bummer &#8211; I really liked that 3-eyed fish!</p>
<p>But fear not, importing graphics is as easy as a cut and paste. If I open my original word version of the form, I can double click near the top of the document, and the header/footer will now be available to edit as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image15.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb15.png" border="0" alt="image" width="493" height="287" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image16.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb16.png" border="0" alt="image" width="182" height="141" /></a></p>
<p>Now you can click to highlight both images and they will paste into InfoPath. Not exactly earth shattering, is it?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image17.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb17.png" border="0" alt="image" width="338" height="325" /></a></p>
<h2>It&#8217;s still not right&#8230;</h2>
<p>Okay, so it wasn&#8217;t a perfect import. In fact I&#8217;d give it about a 6 out of 10. But the point is we have our images and our text inside InfoPath. Also to be fair, MSWord files were not designed for the web either, so it is unsurprising that it wasn&#8217;t flawless.</p>
<p>So, now we can use the native features of Infopath to tidy up this form. First, we will tidy up the arrangement of the two images, and then we will add some graphical elements like textboxes and option buttons to allow the form to be electronically filled in. We will create a table on the form that looks like this</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image22.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb22.png" border="0" alt="image" width="497" height="55" /></a></p>
<p>In the right-hand &#8220;design task&#8221; bar, we select &#8220;Layout&#8221; and then choose to create a &#8220;custom table&#8221;. Choose a 2*2 table and you should see the table as shown in the third image below (look above the fish graphic).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image18.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb18.png" border="0" alt="image" width="168" height="244" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image19.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb19.png" border="0" alt="image" width="172" height="110" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image20.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb20.png" border="0" alt="image" width="413" height="302" /></a></p>
<p>The next step is to format the table correctly. Highlight the two rightmost cells, right click on them and choose &#8220;merge cells&#8221;. The result should be a table looking like the rightmost image below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image21.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb21.png" border="0" alt="image" width="244" height="116" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image22.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb22.png" border="0" alt="image" width="497" height="55" /></a><br />
Now drag and drop the three-eye fish to the leftmost cell and the plant picture to the rightmost cell of the top row of the table. Your result should look something like this.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image23.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb23.png" border="0" alt="image" width="632" height="454" /></a></p>
<p>Now highlight the remaining title text, and then cut and paste it into the empty bottom left cell . Aha! We are starting to look better! A bit of resizing of the table cells width and it is looking more like the original.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image24.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb24.png" border="0" alt="image" width="460" height="186" /></a></p>
<h2>Are we impressed yet?</h2>
<p>Okay, sorry that is very much a rhetorical question, I know. I haven&#8217;t exactly written the most technically complex article ever.</p>
<p>But at least we have gotten the InfoPath version of the form to look much more like the MSWord version. If I had been running that as a client demonstration, it all in all would be around 2-3 minutes work. Is the client blown away in amazement and opening the chequebook yet?</p>
<p>Not exactly, but we haven&#8217;t gotten to the good stuff yet. In part 3, we will add some textboxes and other graphical elements (called &#8220;controls&#8221;) to the form, and then we will do some smart things to reduce manual data entry, as well as ensure that the data that we have collected is accurate.</p>
<p>Bye for now</p>
<p>Paul Culmsee</p>
<p><a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-2/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
