Blog

How to Validate a Due Date in a SharePoint 2010 List

One of the great new features that end-users love in SharePoint 2010 is the ability to validate input. It provides an easy way to make sure that users enter the correct type of data in a metadata field. However, there are a couple questions users often have. The first one is why are there two different places to do it (Column Validation on the Column Settings page and Validation Settings on the List Settings page)? The second question users often have is how can I reference other columns in my validation rules? In this blog post, we’ll answer these two questions from a common case study.

The Problem – How To Disallow a Due Date that is in the Past?

One of the common things people want to do is make sure that people do not set due dates for tasks (or other types of lists) in the past.

Usually the first thing a you will try is to set the validation to [Due Date] > [Today]. This makes sense because you are already use to using [Today] to filter views. However, when you try to do this:
image

You receive an error telling you, “The formula cannot refer to another column. Check the formula for spelling mistakes or change the column to this column.”
The formula cannot refer to another column. Check the formula for spelling mistakes or change the column to this column.

So, the next thing you try is to set the field to validate based on the Creation date. So, you change your validation formula to [Due Date] > [Created] and try again:

image

Unfortunately, this yields the same error message about The formula cannot refer to another column.

A third option you may consider is to use the Today function to create a formula like: [Due Date] > Today().

image

SharePoint seems to like this formula and correctly displays the error message:

image

However, there  is a problem with this solution as well. The validation will occur each time someone edits the task. So, if someone edits the task three days from now, this validation will fail unless the Due Date changes to a date later than the current day. Aaarrggghhh!!!!!

The Solution – So, What’s a SharePoint User to Do?

You’ve probably noticed that there are two places you can set column validation. The one you use most of the time is on the Column Settings page. However there is also one on the list settings page. It’s there at the top. You’ve seen it a thousand times and just never noticed it before. Click on that one.

image

In the Validation Settings link on the List Settings page, you can validate one column against another. Here you can see that I’ve set the [Due Date] > [Created].

image

If your users attempt to enter a due date that is before the creation date, they will see the message you entered:

image

So, you’ve learned a couple things. First, there is a distinct difference between the Validate Settings link on the column page and the Validate Settings link on the Column Settings page: the one on the List Settings page allows you to compare columns, while the one on the column settings page doesn’t. Second, the validation error messages from these two appear in different places on the form: validation error messages created on the column settings page will appear in the column section on the form, while validation error messages created on the List Settings page will appear at the top of the form.

Happy Validating!

Avatar Image
by: Jeff Cate

How to Scale Out a SharePoint 2010 Farm From Two-Tier to Three-Tier By Adding A Dedicated Application Server

Many small to medium-sized organizations start using SharePoint in a “two-tier” server farm topology.  The two tiers consist of:

  1. Tier 1 – SharePoint Server with all web page serving and all Service Applications running on it
  2. Tier 2 – A SQL Server to store the SharePoint databases – the SQL Server could be dedicated to the farm or it might be shared with other non-SharePoint applications.

Visually, this topology looks like this:

image

My experience is that this farm topology can frequently support companies with hundreds of employees.  Of course, it depends a lot on the specifications of the hardware, but with late-model quad-core Xeons running on the two servers and 8 – 16 GBs of RAM on each one with RAID built with 15k RPM SAS drives in the SQL Server, this configuration with SharePoint Server 2010 can perform very well in many organizations that have less than 1000 users.

At some point, an organization that started with this two-tier topology may want to scale out to the next level which is a three-tier topology.  The three tiers would be:

  1. Tier 1 – SharePoint Server dedicated as a Web Front-End (WFE) with only the web application(s) and the search query service running on it
  2. Tier 2 – SharePoint Server dedicated as an Application Server with all of the other service applications running on it, but no web applications or query service
  3. Tier 3 – SQL Server for the databases

Visually, this topology looks like this:

image

There are many different reasons why a company might want to scale out to three-tiers from two.  Some kind of performance improvement is frequently what drives it.  However, it may not be the obvious one of desiring better page serving times for the end users.  For instance, I frequently see companies do this to move the search crawling and index building process to a different server that is more tuned for its unique resource requirements and can do a more efficient job of crawling and indexing the company’s content.  Perhaps in the two-tier approach their crawl\index component can’t get enough hardware resources to crawl through all of the content on a timely basis.

One more point.  Many organizations will also choose to add a second WFE when they scale out to a three-tier farm.  (I don’t show this in the diagram above).  The second WFE will be configured exactly like the first one and some type of network load balancing (NLB) mechanism will be put in front of the WFEs to intelligently route user traffic to the two servers to balance out the load.   In this scenario, the three-tier farm diagram above would be modified to add a second WFE and the total number of servers in the SharePoint farm would be four.

Getting From Here to There

Here is a screen shot of all of the service applications that run on the SharePoint 2010 server in a two-tier farm when you install SharePoint Server 2010 Enterprise edition and run the out-of-the-box Configure Your SharePoint Farm Wizard and choose to provision all service applications:

image

(2nd Reminder: for this post, I am working under the assumption that you have used the SharePoint 2010 “Configure your SharePoint Farm” wizard and have opted for it to provision all of the SharePoint Server 2010 **Enterprise Edition** service applications).

Your goal is to add a third server to the SharePoint 2010 farm and have it take over running all of the service applications in the list above, with the exception of the three that have been circled.  The three that have been circled in the screen shot are the ones that are necessary for the original server to function as a dedicated WFE with query processing. 

The Search Query and Site Settings Service and some of its associated functionality in the SharePoint Server Search Service are technically not required on a WFE, but it is the best place to put them.  The reason is that this is the process that takes the user’s search query and looks it up in the indexes.  The indexes are files that the query processor needs local access to and are stored on the file system of the server(s) that is running the query service, not in SQL Server. 

So, for best performance it is recommended to run the Search Query and Site Settings Service on the WFEs that are serving the pages.  The crawling and index process is a separate process whose job it is to build the indexes and push them up to the query servers.

The Search Topology configuration settings in SharePoint 2010 dictate what functionality of the SharePoint Server Search Service runs on what server in the farm.  So, while the SharePoint Server Search Service needs to run on both the WFE and the Application Server in this example, it will be possible break out the functionality that it performs on each.  We will want it to perform query-related functionality on the WFE and crawling/indexing functionality on the Application Server.  Later in this post I will show you how to do this.

Now, on to the actual steps to doing the work:

 

Step by Step: Scaling SharePoint 2010 to Three Tiers

Step 1 – Build a new SharePoint Server with exactly the same software

I’m talking about taking a fresh physical or virtual server that has Windows Server 2008 (R1 or R2) running on it, and installing all the same SharePoint Server 2010 software on it that is installed on the existing SharePoint 2010 server in your existing farm.  That includes the full RTM Enterprise edition, whatever patches have been applied in your farm since RTM, and any other separate products that have been installed on your existing server such as the Office 2010 Web Applications and its patches.

Step 2 – Run the SharePoint 2010 Products Configuration Wizard on the new server and join the existing farm

I recommend installing all RTM software and all patches that have previously been applied to the farm BEFORE running the SharePoint 2010 Products Configuration Wizard from the new server’s Start menu.  This means that you will want to respond NO to the prompt to automatically run the wizard until you have installed all software packages on the new server.  This will save you from having to run the wizard multiple times.  Run it once – after you have installed all software and patches on the new server.

When you do run the SharePoint 2010 Products Configuration Wizard, you will run it on the new server that will be your application server.  The wizard is going to help you join the server to the farm and get all of the software configured and running that you installed in Step 1.

Here are what the pages of the wizard look like as you go through the process:

image

 

image

 

image

 

image

 

image

Oops, you forgot to install a piece of software on this new server that is already installed on the other server.  The wizard has caught your error and is not going to let you proceed until you get this done.

Exit the wizard and go install the software – in this case, the Microsoft Office 2010 Web Apps.

OK, you got the missing software installed and have restarted the wizard.  The next screen asks you for the Farm PassPhrase.  This is a special password you created when you originally created the farm.  You have to enter it here in order to join this server to the farm:

image

image

If you click on Advanced Settings above, the next page asks whether or not you want to use this server to host the Central Administration website (sort of implying that you could move it from your existing SharePoint 2010 server to the new one). 

I haven’t tried selecting the second option in SharePoint 2010.  In MOSS 2007, according to this blog post you needed to remove the Central Administration web application from the original server before you got to this step on the new server. In the context of scaling out by adding an application server, that is probably what you would want do.  If you choose to go this route, just make sure you have good backups before you delete the Central Admin site from the existing server. Smile

For this walkthrough, you are going to leave Central Administration on the existing server:

image

 

image

 

image

Now the server has been joined to the farm and is a full-fledged farm member.  But, the Configure Your SharePoint Farm Wizard in Central Administration needs to run to add the service applications that exist in the farm to this new server.  So, it automatically fires up your browser and asks you to run the Farm Configuration Wizard:

image

 

After you start the wizard, it will just run for a while without any input from you and return this page if everything was successful:

image

 

Step 3 – Verifying that everything is running properly on the new server

It’s a good idea at this point to go verify that the new server is showing up as a member of the farm with a healthy status.  To do that go to Central Administration > System Settings > Manage Servers In This Farm and find the new server and verify that it has a “No action required” status:

image

 

image

 

Take a moment to breathe deep and pat yourself on the back Smile.  You have done a lot of work to get to this point.  You now have a three-tier SharePoint 2010 farm. 

But, there is more work to be done so that your three-tier farm has only the web page serving and query processing services running on the WFE and all of the other service applications running only on the Application Server.  Until you get that accomplished, the job is not done. 

(Note: the farm will work and be fully functional if you stop here.  You will have the same Service Applications running on multiple servers and SharePoint 2010 will automatically use this topology as a load balancing technique for the Service Applications.  There may be some environments where this is desired.  But, most organizations will want to separate the web-serving services and the application-serving services to provide a better balance for the farm as a whole as opposed to just load balancing the Service Applications.)

Step 4 – Re-configure the servers to run the services that are appropriate for their individual roles

You want the Web Front-End to run these (and only these) services:

  1. Microsoft SharePoint Foundation Web Application (this is what turns IIS into a SharePoint “page-serving” machine)
  2. Search Query and Site Settings Service (the process that takes the user’s query string and looks it up in the index)
  3. SharePoint Server Search Service (but just the functionality that is necessary for the query processor)
  4. Central Administration (assuming you didn’t decide to move it to the Application Server)

You want the Application Server to run these (and only these) services:

  1. Access Database Service
  2. Application Registry Service
  3. Business Data Connectivity Service
  4. Excel Calculation Services
  5. Managed Metadata Web Service
  6. Microsoft SharePoint Foundation Incoming E-mail
  7. Microsoft SharePoint Foundation Workflow Timer Service
  8. PerformancePoint Service
  9. Secure Store Service
  10. SharePoint Server Search (but just the scheduled content crawling and indexing building functionality)
  11. User Profile Service
  12. Visio Graphics Service
  13. Web Analytics Data Processing Service
  14. Web Analytics Web Service
  15. Word Automation Services
  16. Word Viewing Service

If you can get this done and everything works properly, you will have achieved your overall goal.

(Important Note: Step 1 above is really the only step in the process that can be done during normal working hours.  Everything else has the potential to impact the availability of the system to the users.  If everything goes smoothly, it is possible to do Step 2 through Step 4 in two to four hours.  Of course, it is highly recommended to have solid backups in place before starting Step 2.)

For the most part, the re-configuration of the services involves stopping a lot of services on the WFE server (using the Services on Server page in Central Admin) and verifying that they are running on the new server (which they probably are because the Configure Your SharePoint Farm wizard started them up when you ran it in Step 2).  Then, you will want to make one last pass over the list of services running on the Application Server and make sure that the Microsoft SharePoint Foundation Web Application Service and the Search Query and Site Settings are not running on it.

Adjusting the Search Application Topology

The exception to the statements of the previous paragraph is the search-related services:  SharePoint Server Search Service and Search Query and Site Settings Service.  Search is complicated enough that it has its own topology configuration settings.   You need to use this capability to place the query functionality of the SharePoint Server Search Service on the WFE and to place the crawling\indexing functionality of the service on the Application Server.

Since this is a little more complicated than the other Service Applications, go ahead and do this one first.

Navigate to the Search Administration home page in Central Administration.  Scroll down to the bottom of the page until you see the section titled Search Application Topology:

image

This part of the page shows you what servers the following four components of the Search service are running on:

  • Search Administration component
  • Crawling component (this is the crawling engine that crawls your content and builds full-text indexes from it)
  • Database component (as the crawling engine crawls through the content, it stores the full-text indexes in SQL Server.  It also compiles the full-text indexes into special non-SQL files that can be propagated up to the WFE)
  • Query component (this is the component that receives the user’s query and looks up the results in the special files that have been propagated to the hard drive of the WFE)

The Server Name column shows that the Search Administration, Crawl, and Query components are currently running on the existing server (SPS-INTRANET in the example).  The search-related databases are running on the SQL Server.

You want to do the following:

  1. Move the Search Administration component to the new Application Server
  2. Move the Crawl component to the new Application Server
  3. Leave the Database component running on the SQL Server
  4. Leave the Query component running on the WFE

To accomplish this, click on the Modify button to go to the Topology for Search Service Application page:

image

By hovering your mouse over the component lines, you can bring up a drop down menu and select Edit Properties for the components you want to move to the new server. 

Do this now for the Search Administration component:

image

 

Now do it the same way for the Crawl component (screen shot is the same as the one above).

 

Once you have changed the server assignments for these two components, you need to kick of the actual transfer of responsibilities by clicking on Apply Topology Changes:

image

 

The actual transfer of responsibilities begins:

image

When it is finished, you will be returned to the Search Administration home page and you should see that the components have been transferred as directed and all of the search-related servers should have a status of “Online”:

image

Note:  I am not sure why, but this page never shows anything in the Status column for the Databases component.  So, it is normal for that column to be blank for that component.

 

Transferring the remaining Service Applications

All that is left is to use the Services on Server page in Central Administration to make sure the list of services running on each server matches your master list from above:

You want the Web Front-End to run these (and only these) services:

  1. Microsoft SharePoint Foundation Web Application (this is what turns IIS into a SharePoint page-serving machine)
  2. Search Query and Site Settings Service (the process that takes the user’s query string and looks it up in the index)
  3. SharePoint Server Search Service (only the functionality that is necessary for the query processor)
  4. Central Administration (assuming you didn’t decide to move it to the Application Server)

You want the Application Server to run these (and only these) services:

  1. Access Database Service
  2. Application Registry Service
  3. Business Data Connectivity Service
  4. Excel Calculation Services
  5. Managed Metadata Web Service
  6. Microsoft SharePoint Foundation Incoming E-mail
  7. Microsoft SharePoint Foundation Workflow Timer Service
  8. PerformancePoint Service
  9. Secure Store Service
  10. SharePoint Server Search (only the scheduled content crawling and indexing building functionality)
  11. User Profile Service
  12. Visio Graphics Service
  13. Web Analytics Data Processing Service
  14. Web Analytics Web Service
  15. Word Automation Services
  16. Word Viewing Service

To do this, you use the Server drop-down control to select the server you want to adjust, and then use the Start/Stop link in the Action column to turn on/off the services.

Here is what your Services on Server page should look like once each has been properly adjusted fore each server:

For the Web Front-End (SPS-INTRANET in this example):

image

 

For the Application Server (SPS-APPSVR in this example):

image

 

If you navigate to the Servers in Farm page of Central Administration, you will see a more succinct view of your new farm topology:

image

 

Step 5 – Testing and Verifying

Even though you are ready to head out the door and head home since you are probably doing this on a night or weekend, it is really important to fight the urge to leave too soon.  You really need to do some basic testing and verification before you leave.  It will be a lot better to find out about any problems now rather than when the next business day has already started.

Here is what I recommend doing before you leave:

  1. Browse to each of your SharePoint web applications and log in with your user account and make sure you can hit the home page of each of them.
  2. While you are there, try to open up and edit a document in the browser using one of the Office 2010 Web Apps (Word, PowerPoint, Excel or OneNote).
  3. Browse to your My Site and verify that everything is working normally.
  4. Add a unique phrase to a test page somewhere in one of your Sites (I always use the phrase “jabborwocky” Smile) and then go run an incremental Search crawl from Central Administration.  After the crawl completes, go back to your Site Collection and search for the phrase.  Verify that it comes up in the results.
  5. Run an incremental User Profile Synchronization from the User Profile Administration page.  While it is running, logon to the desktop of the new Application Server, and find this program and run it:  c:\program files\microsoft office servers\14.0\synchronization service\uishell\miisclient.exe.  This is the Forefront Identity Management (FIM) client application that you can use to see the details of the AD synchronization process.  Several jobs will be run by FIM.  Verify that they all complete successfully with no error messages.
  6. In Central Administration, go into Manage Service Applications and click on Managed Metadata Service and select Manage in the ribbon.  Verify that the Term Store management interface loads and that you can add/change/delete a Term Set and some Terms.
  7. Finally, reboot your WFE and Application Server.  When they come back up, check your Windows System and Application event logs on those servers and verify that there are no SharePoint-related critical or warning events that you haven’t seen before you scaled out to three tiers.
  8. Browse to your primary web application one more time before you head out the door.

 

I hope this blog post is a good resource for those SharePoint Server Administrators who find themselves needing to scale out to the next level!

SharePoint-InfoPath 2007 Video Tutorial: Displaying SQL Data in Data View Web Parts (Part 2)

How-to video: Create an InfoPath form that stores form data in SQL

Part 1: Create a web-enabled InfoPath form that stores form data directly in SQL

Part 2: Create data view web parts in SharePoint Designer to display/update SQL data in SharePoint pages

Part 3: Filter SQL data with a form web part and create SharePoint list items from SQL data

This SharePoint video tutorial is based on a simple concept: Store customer suggestions for product improvement or new product ideas in SQL and create a SharePoint page to find, filter, view, and manage the task of implementing the good suggestions.

 

SharePointDesignerSQLDataForm
Data view/data form web parts to display/update SQL data

 

SharePointDesignerDataViewSQL
View part 2 of the SharePoint training video series here

SharePoint-InfoPath 2007 Video Tutorial: Storing InfoPath form data in SQL (Part 1)

How-to video: Create an InfoPath form that stores form data in SQL

Part 1: Create a web-enabled InfoPath form that stores form data directly in SQL

Part 2: Create data view web parts in SharePoint Designer to display/update SQL data in SharePoint pages

Part 3: Filter SQL data with a form web part and create SharePoint list items from SQL data

This SharePoint video tutorial is based on a simple concept: Store customer suggestions for product improvement or new product ideas in SQL and create a SharePoint page to find, filter, view, and manage the task of implementing the good suggestions.

image 
Web-enabled InfoPath form

 

image 
Form data stored in SQL database table

 

image
Suggestion tracking dashboard page

 

 InfoPath-SQL-Video-Tutorial
View part 1 of the SharePoint training video series here

Visio Services Won’t Refresh in SharePoint 2010–How to Fix It

I recently ran across a problem where a user had connected a Visio 2010 diagram to data in a SharePoint list to create a dynamic graphical dashboard of the items in the list. He had a problem though that the data wouldn’t refresh. So, when values changed in the SharePoint list, the Visio diagram that had been published to SharePoint as a Web Drawing wouldn’t update automatically, nor would it update when the Refresh button was clicked.

It was an end user (or rather power user) who was experiencing the problem who was not the SharePoint Administrator. So all he knew was that it wasn’t working. He didn’t receive any errors or anything to indicate what the problem might be.

The solution turned out to be a configuration problem in Central Administration—which this user couldn’t access.

When I logged into Central Administration, I clicked on the SharePoint Health Analyzer and saw an issue that said, “The Unattended Service Account Application ID is not specified or has an invalid value.” This was our culprit, but there was nothing in that description to indicate it affected Visio Services at all.

The Unattended Service Account Application ID is not specified or has an invalid value.

When I clicked on the link, I saw the following details for the issue:

image

This told me everything I needed to know to resolve the problem. I clicked on Application Management > Manage service applications.

Application Management > Manage Service Applications

I then selected the Secure Store Service and clicked Manage.

Manage Secure Store Service

The Secure Store Service in SharePoint 2010 has replaced Single Sign-On that was in SharePoint 2007. The service securely stores credentials that are associated with a given application identification. On the next page, I could see that nothing had been configured here. In fact, I saw a notification stating “Before creating a new Secure Store Target Application, you must first generate a new key for this Secure Store Service Application from the ribbon.” To do this, I clicked on the Generate New Key icon.

Before creating a new Secure Store Target Application, you must first generate a new key for this Secure Store Service Application from the ribbon.

On the next page, I had to enter the Pass Phrase that was created when the farm was created. You did make a note of that somewhere didn’t you? Smile

Generate New Key - Pass Phrase

After clicking OK, the notification went away and more of the ribbon icons became active.

There are no Secure Store Target Applications in this Secure Store Service Application. You can create a new Target Application from the Mange Target Applications group inthe Edit ribbon group.

I entered in the Application settings shown below, which were appropriate for this environment. Essentially, your Target Application ID and Display Name can be whatever you want it to be. If you are just configuring this to make Visio Services refresh start working, you’ll probably be fine with all the other defaults too.

Target Application Settings

On the next page, I accepted the defaults there and clicked Next again.

Target Applicaton Fields - User Name and Password

On the next page, select any users you want to be able to manage the settings.
Target Application Administrators

This finished creating my Target Application.

Target Applications

Now that this was created, I just had to associate it with Visio Services. In Application Management > Manage Service Applications, I selected Visio Graphics Service and clicked Manage on the ribbon.

Manage Visio Grpahics Service

I clicked on Global Settings.
Visio Graphics Service > Global Settings

At the bottom of the Global Settings page for Visio Services, there is a section called External Data where you can enter the Application ID for an Unattended Service Account. Here I entered the Application ID I had just created and clicked OK.

Visio Graphics: External Data | Unattended Service Account | Application ID

After this, I returned to the Visio Web Graphic and the refresh was now working properly.

Hopefully this will help some of you. If you are the end user or power user that is experiencing this problem, be sure to forward this post to your SharePoint Administrator as this is probably the culprit.

SharePoint 2010 Tutorial Video: Drop-Down Filters

How to video: Create Optional Cascading Drop-Down Filters on SharePoint List Forms

I knew I was going to like the ability to customize list item forms in SharePoint 2010 using InfoPath. The ability to filter drop down list choices based on a previous selection in the form is something many people ask for.

I have created a SharePoint 2010 tutorial/training  video that shows how to customize the new item form in InfoPath, wire up drop down choice lists to information in a SharePoint list and filter and have the choices in one drop down filter the choices in the next. And yes, the use of the filters is an option for the user.

image

The facilities department is responsible for equipment in offices, manufacturing and retail sales locations in thirty or more buildings located in about a dozen cities in three states. This solution gives users the choice of picking directly from the entire list of buildings or filtering first by state and city (see screenshot above).

The video below will walk you through the entire process from creating a custom list, adding a lookup column that pulls back multiple columns of meta data, customizing the list item form in InfoPath and wiring up the optional cascading filtered drop down choice fields.

SharePoint-DropDown-Filter

Create a Detailed Custom Task Notification with a SharePoint Designer Workflow

It seems that few SharePoint users are happy with the out-of-the box task notifications. While they serve their purpose, we often want highly customized emails that contain more information about the task.

I recently created a workflow that used the Collect Data from a User activity. When you go through the Custom Task Wizard, SharePoint Designer creates a Content Type (based on the parameters you selected) in your site and adds that content type to the Workflow Tasks list for the site. The task notifications use the standard template though and look like this:
image

So, in this example, Alan needs to correct something in inventory. He can see that an item called “Shipped to Dan’s Bikes” created the task, but he really doesn’t have any idea what he needs to correct, or why he needs to correct it. He could probably figure it out if he clicked on the link to Shipped to Dan’s Bikes, but that’s not very intuitive and still means more work for Alan. If he clicks on the link to Edit this task, he doesn’t get much more details there:
image

Alan would like to receive an email with all the details he needs and a link to this form to enter his count.

We’ll need to do a few things to replace SharePoint’s default notification with our own. The first thing we need to do is turn off SharePoint’s default notification. On the Workflow Tasks list, go the Advanced Settings and select No for Send e-mail when ownership is assigned.
image

Next, you’ll need to launch SharePoint Designer, open the site, and create a new workflow.Attach the workflow to your Tasks list and select the option to run when a new item is created.

It’s possible that your Tasks list could contain multiple types of content types, so you’ll want to add conditions in your workflow for each Content Type or create separate workflows for each Content Type. My Content Type was called Inventory Correction, so I check for that in my first condition:
image

I want my email notification to contain some details about the task and be less generic than the out of the box notifications. You’ll remember that notification just said, “Tasks – Inventory Correction Has Been Assigned To You.” I would like it to say, “New Task: Correct Inventory for the Appalachian Mountain Bike” so that the recipient had a better idea of what he had to do. So, the first action I added to my workflow was Build a Dynamic String. In the String Builder, I typed in the my static text and added a Lookup to get the name of the bicycle from the list item on which the workflow was running that created the task. To find this I matched the Current Item: Workflow Item ID with the ID of the item in the Inventory Adjustments list (that is the list that triggered this task to be created). The lookup looked like this:
image

And the Dynamic String looked like this:
image
I stored that string in a variable named New Task Title. 

So, another important lesson here is that the Workflow Item ID always matches the ID of the item on which the workflow was running that created the task, so it can be used to get to any of that information. Sweet!

Next, I added an action to my workflow to Send and Email. In the Define E-mail Message dialog, I set the subject line to be the Dynamic String I just created.

I also wanted a link directly to the form to edit the task. So, I opened up an existing task and copied the URL for it from my address bar. I added some HTML anchor tags to my email and pasted this URL in as the HREF. I also needed to Look Up to change the ID for the task.

In the body of the email, I used the Workflow Item ID to do lookups on the Inventory Adjustments list to dynamically populate the Bicycle Type, who created the adjustment that caused the problem, and the original adjustment amount. Here is what my completed dialog looked like.

image

Finally, I wanted to change the Title of the task in the task list to provide more information. I used the Set Field in Current Item activity to change the Title to be the same thing as the subject line of the email. Here is what the complete workflow looked like:
image

When this workflow runs, it changes the Title of the task from the default “Inventory Correction” (which is the name of the Content Type) to “New Task: Correct Inventory for the Appalachian Mountain Bike.”image

And the Warehouse Manager gets an email with a link to the edit task page and all the details about why he needs to make the correction:image

If you want to learn more about how to take you SharePoint Designer workflows to the next level, be sure to sign up for our Mission: Automation – SharePoint Workflow and InfoPath class! Hopefully I’ll see you there!

Using Google Search Appliance on Your SharePoint Site

Adding a Google search to a web page is pretty simple. Just drop in the search form code. Something like this:

<form id=”search-form” method=”get” action=http://search.yoursitehere.com/search>
        <input type=”text” name=”q” size=”25″ maxlength=”255″ value=”"/>
        <input type=”submit” id=”search-submit” name=”btnG” value=”Search”/>
        <input type=”hidden” name=”site” value=”default_collection”/>
        <input type=”hidden” name=”client” value=”default_frontend”/>
        <input type=”hidden” name=”proxystylesheet” value=”default_frontend”/>
        <input type=”hidden” name=”output” value=”xml_no_dtd”/>
</form>

The fact that the search code is in a form tag is a problem. Basically the entire body of your SharePoint page is in an ASP .NET form and you cannot have nested form tags as the inner <form> will not be processed. Some have tested ways of nesting form tags but it is pretty messy and not consistent across browsers.

I found this post that addressed the issue and his code was a great starting place. In fact it worked great on my virtual machine but was giving me issues on the production site. The problem turned out to be the code that was specifying the background image for the search box. A white background was preferred anyway so the code was simplified a bit to the following:

<div>
    <input id=”q” type=”text” size=”25″ style=”border: solid 1px #999999″ onkeydown=”searchkeydown();” />
    <button onclick=”googlesearch();return false;”>Search</button>
</div>
<script type=”text/javascript”>
     searchkeydown = function() {
         if (window.event) {
             key = window.event.keyCode;     //IE
         }
         else {
            key = e.which;     //firefox
         }
         if (key == 13) {
            event.returnValue = false;
             event.cancel = true;
             googlesearch();
         }
     }
    googlesearch = function() {
    window.location=’http://search.yoursitehere.com/search?q=’ + escape(document.getElementById(’q').value);
      }
</script>

That should get your Google Appliance (CSE) working in your SharePoint site.

Loading SharePoint Dlls into Reflector

As a developer, I like to load all of Microsoft’s SharePoint DLLs into Reflector so I can peek under the hood when needed. Just follow these easy steps to load all the SharePoint DLLs into reflector:

1. Open a Powershell command shell

2. Make a temporary directory or use an existing one. I’ll use \usr\tmp\ in this example.

3. cd to \windows\assembly\GAC_MSIL, then run the following command:

4. dir | select-string “Microsoft.SharePoint” | foreach {cd $_\14*;cp .\*.dll \usr\tmp\; cd ..\..\; }

5. Now all SharePoint DLLs will be in \usr\tmp. Just open Reflector, browse to \usr\tmp and add the list of assemblies (shift click to select all).

Happy Reflecting :)

Use Multiple Selection Columns in Calculated Fields

I recently had a need to create a hyperlink in a custom list and the hyperlink needed to contain parameters that came from a Choice type column that allowed multiple selections. I’m very comfortable using Excel’s string functions (LEFT, RIGHT, MID, LEN, and FIND) to parse strings and I’ve done so many times. However, when I tried to write a formula using the Multiple Selection field, I got an error that said, “One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas.” Rats! I thought that we might need to write an event receiver with Visual Studio to accomplish my task, but I really wanted to find a way to do it without writing any code. Here is what I did to solve the problem.

The Problem

In this particular scenario, a department stores information about events in a custom list. There may be one or two people from the department who attend the event. The names of these employees are stored in a column of type Choice that has been set to display as Checkboxes (allow multiple selections).

They use a web based program as part of managing the event. Information about the event is passed to web application as variables in the URL. Two of those parameters are the employees who are attending the event. They want SharePoint to automatically create the URL and modify it if the item changes.

Here is a simplified example of what they want to see in their SharePoint list:
image

The Solution

This customer is using our Workflow Essentials product that adds 24 more activities to SharePoint Designer workflows. I decided to make use of two of the Text Capture activity to extract the parts of the string I needed (if you are interested, you can watch a short video on how the Text Capture, Text Replace, and Text Validate actions work).

The Text actions in Workflow Essentials use Regular Expressions to look for values within text (a great place to learn more about Regular Expressions is: http://www.regular-expressions.info/).

When a column is set to allow multiple items to be selected, SharePoint stores them in a plain text format with the items separated by semicolons; you can see this in the example above.

The first Regular Expression I wrote extracted the first word in the My Persons string. The That regular expression is: ^\b[A-Za-z]+\b
The second Regular Expression I wrote extracted the second word in the My Persons string. That regular expression is: \b[A-Za-z]+\b$

Note that regular expressions don’t actually extract anything, but rather returns the part of the original string that matches the given regular expression. These two expressions worked in my case because my strings consisted of single words that consisted only of singe letters and there was a maximum of two words total. If my string had different qualities, I would have to have written totally different regular expressions to match my particular criteria. Writing Regular Expressions is a very valuable, and often under valued, job skill. I’m not an expert at it so I won’t likely be a good source for writing a regular expression for your particular case. Sorry.

Once I had written my Regular Expressions, I was ready to create my solution. I launched SharePoint Designer and created a new workflow on my list that would run when a new item was added or when an item changed.

I added the Text Capture activity first, used my first Regular Expression as pattern and output the captured text to a variable named FirstChoice. Then I added another Text Capture activity where I used my second Regular Expression and captured the matched text to a variable named SecondChoice. Next I added a Build Dynamic String activity where I composed the URL and inserted the two variables in the appropriate place for the URL parameters. Finally, I added a Set Field in Current Item activity where I set the My URL field to the string I had just created. Here is the entire workflow.
image

As you can tell, Workflow Essentials is a powerful product that can greatly increase the power of your SharePoint Designer workflows. Check it out!