User Lookup fails, block generic users

Feb 4, 2008 at 2:48 PM
I suppose this is just a FYI tip for anyone who may need it.

I had some problems with the user lookup activity because we have some generic accounts that people can log in with. If a person was logged in with a generic account then the 'lookup site user property' action would fail because the department property was not populated, and the workflow would stop immediately. I found a way to block users from completing a form by checking the userid as the form is being loaded.

First I set up an xsl:variable that checks a list of Invalid Users. I actually have about a dozen but this shorter list should supply the idea.

<xsl:variable name="InvalidUsers" select="$UserID = 'System Account' or $UserID = 'Administrator' or $UserID = 'Some Other Generic Account' " />

even though the actual account may be administrator, it is important to include the display name of the account in the $UserID check. For example, we have an admin account where the username is 'admin' but the display name is set to 'System Account'.

The second step was to put in a check in the code. Looked like this.

<xsl:when test="$InvalidUsers = 'true' " >
<tr><td class="ms-standardheader ms-WPTitle" nowrap="">
You are not allowed to register for a course under the '<xsl:value-of select="$UserID" />' user name.
<tr><td class="ms-vb" nowrap=""><br />
Please Sign In using your IT account to register for a course.

Other xsl:when's can check other things or you can call the body template to display the form.