Making a Read Only PDP with InfoPath Forms

The genesis of this post lay in a conversation I had with a client.  The goal of the discussion was to identify a method to lock down specific project detail pages (PDP) within Project Server.  I figure that there’s probably a number of ways to accomplish this, but since I had been playing with InfoPath lately, this seemed to be the most logical choice.

From a process standpoint, the locked down PDP would enable a PMO to set specific fields at the project initiation, and then either prohibit or strongly discourage project managers to modify these fields.  If you’ve used Project Server for any time, of course, you’ll know that there is no true field level security….once a user can edit the project in Microsoft Project Professional, all of the fields may be edited.  But in some cases, perhaps where the project manager is primarily interacting with the project within the browser, this may be an effective way to control fields.

For other techniques that would probably be used in conjunction with this, I would encourage you to take a look at this post on security trimming PDPs, and some of my early posts of extending PDP pages into SharePoint lists.  At some point, I’ll probably come up with a proposed solution for leveraging SharePoint lists to provide secure extensions of Project Server data.

The Challenge

So the challenge I set before myself was to replicate a PDP page, but to make it read only.  At the end of this experiment I wanted to be able to pull up a PDP page, and have it render Project Server data without requiring any further input from the user.  My conclusion is that it’s not all that hard to accomplish this, albeit it requires a couple of tricks to get the output of the Query Filter Webpart to match the data requirements of the database query.

Preparing the SharePoint Site

The first thing we need to do is to add two libraries to our main PWA site: a data connection library and a forms library.  The data connection library will contain the required UDC file to link our form to the Project Server database.  The forms library will contain the form for our PDP pages.

You’ll find the options to create both libraries after selecting the View All Site Content option under Site Settings, then clicking Create and Libraries.

image

As a useful trick, you may note an InfoPath form maps to a specific content type within the form library.  If you plan on deploying this solution with different InfoPath forms, you’ll probably want to enable content type management within the forms library and then create a couple of extra content types.

Once you’ve created those two libraries, you’ll probably want to confirm that InfoPath is in fact configured within your SharePoint farm.  To do that, you’ll have to navigate to the Central Admin site.  Click on the General Application Settings.

image

Click on Configure InfoPath Forms Services.  Assuming that this does not violate your organizational security policies, go ahead and check the last three check boxes.  Click OK.

image

Close Central Admin.

Creating the Data Connection

To create the data connection, let’s open a blank form in InfoPath Designer.

image

On the Data tab, click on the Data Connections button.

image

Follow the default options to create a new data connection file to receive data from a SQL database.  For this example, I will be using the EPMProject_UserView table from the Reporting database.

image

Select the fields that you will require.  For this post, I’ll just go ahead and select all the fields in the view.

image

Complete the wizard.  Make sure to deselect the last checkbox on the last screen.

image

Once you get to the Data Connections dialog box, select to convert the newly created data connection to a connection file.

image

Post the connection file to the connection library created when we started this process.  Close InfoPath and navigate to the connection library.

image

As versioning is turned on within this library by default, you may need to click on the drop down arrow next to the connection file and set it to approved.

Configuring the InfoPath Form

Our next step is to create the InfoPath form.   With the data connection created, this is actually quite simple – with one minor caveat.  We need to add a mechanism to the form to manipulate the data received from the query string filter and convert it into something recognizable by the form query.

Create a new form with the Data Connection File template.  You could probably use any template, but this is the one that seemed the most appropriate when I was writing this post.

image

Connect it to the data connection created previously.

image

You should end up with a screen that looks like this.  Note the data fields on the right hand side of the screen.

image

InfoPath fields show up in two flavors: query and data.  The query fields are used to query the database….the data fields yield the results.  So our goal is to add the Project UID field to the appropriate query field, trigger the query, and show the results in the data fields at the bottom of the form.

You may wish to play with various permutations of this form, but the simplest way to emulate the PDP functionality is to delete everything but the data field box.

image

Now add a custom field called TempUID to the form data set by right clicking on the myFields item in the right hand dialog box.  This will create a field called my:TempUID.

image

Now click on the option to Manage Rules in the Ribbon.  Select the TempUID field, and click the option to set a New rule.

image

Set the rule to set the query field ProjUID whenever the TempUID field is changed. (Not the data field). The format for the data will appear as follows:

concat(“{“, translate(., “abcdefghijklmnopqrstuvwxyz”, “ABCDEFGHIJKLMNOPQRSTUVWXYZ”), “}”)

…where the “.” represents the TempUID field.  This formula does two things:

  • Adds round brackets around the TempUID entry, i.e. {abcdef}
  • Converts the lower case letters to upper case, i.e. {ABCDEF}

If you don’t add this formula, then the query will return an error stating that the ProjUID field is invalid data.  When completed, the calculation should look something like this (noting again that the field name appears as a “.”):

image

Add a second rule to the same field to query for data after the first rule is run.

image

Going back to the form, drag the desired fields to the data field box.

image

Save the form, and publish it to the form library created at the beginning.  When publishing the form, promote the TempUID field so that it may be used in Webpart connections.

image

After publishing the form, close InfoPath.  You are now ready to create the Project Detail Page.

Creating the PDP

Back in Project Server, navigate to the Project Detail Pages under Server Settings.  Add two Webparts to the page, the Query Filter web part and the InfoPath form.  Edit the Query Filter Webpart to pull the ProjUID parameter.

SNAGHTML2154f81

Configure the InfoPath form to pull the Query String Filter into the TempUID field we promoted when we published.

image

…and that’s it.  Add the PDP to your project type, and it will automatically display Project Server data whenever the page is viewed.

SNAGHTML21954ce

Yes, I admit the form is kind of ugly – and that description field got truncated, but dressing up InfoPath forms is probably a decent topic for another post.  For now, we got the data to show up – which I think is pretty good progress.

Credits

To give credit where credit is due….thanks very much to Jimmy McAnally (@jimmymcanally), a former colleague.  I ran into him at a recent Houston SharePoint User Group meeting, and he graciously spent a couple of hours helping me with a different hypothetical InfoPath question.  In the process, he ended up teaching me enough about InfoPath to get me started down this path.  Also thanks to Clayton Cobb (@warrtalon), SharePoint MVP, for graciously attempting to help me out on the online forums – despite my near-incoherence in being able to actually describe the issues I was facing.  I’ll give them credit for everything that actually works in this post and I would encourage you to blame me for any incorrect or misleading information.

Advertisements
Making a Read Only PDP with InfoPath Forms

Creating a My Projects View

With the expansion of Project Server 2010 to include enhanced capabilities in browser-based project creation, I have found many organizations hard pressed to manage the sheer numbers of projects that now appear in the Project Center view.

This post documents a quick and easy view that may be created within the Project Center view to filter projects on only those projects where the user is the owner, essentially creating a “My Projects” view.

This technique is based on two assumptions:

  1. Your organization, like many organizations, allows project managers to see all projects read-only – or at least all projects within specific parameters.
  2. Your organization is using a more or less default security model (whatever that means).  Let’s say that your security model isn’t too crazy and hopefully is compatible with this configuration.

Create the View

Navigate to the Manage View option within Server Settings.

image

Make a copy of the Project Center Summary View.  Note that I like to prefix any custom view with a “*” and the company name.  This allows me to easily identify the more commonly used views.

image

Take the view out of every category but the My Projects category.

image

Confirm Security Settings

For the next step, we’re going to review the My Projects security settings as applied to the Project Manager group.  Within Server Settings, navigate to the option to Manage Categories.

Click on the My Projects category. 

image

Note the default settings for the category.

image

Uncheck two of the boxes so the settings look like this.

image

Note that this may have some unintended consequences as the Team Members may be using that category to view projects to which they have been assigned.  If you believe that changing this security model may have a significant impact on your organization, simply copy the My Projects category in the beginning and then follow the same instructions.

The end result should be a filtered list of personal projects within the Project Center view.

Creating a My Projects View