Wednesday, April 30, 2008

Sharepoint, workflows, CodePlex, and other invaluable resources to do my job

Recently, I worked on a Sharepoint project solution for our attorneys to be able to create projects and assign them to summer associates.  When the project is completed, a workflow kicks in and sends an email to the responsible attorneys to let them know it is completed.  In building the email, I ran into a problem with converting the user name of the assigned associate into their real name.

In the workflow built with Sharepoint Designer, I added a lookup field to the Subject line of the email.  It came from the Current Item and the AssignedTo column.  The email was sent and in the subject line the name was formatted “domain\username”.  So, how do I convert the name?

After looking and looking for help, I found a wonderful open source solution for custom workflow activities on CodePlex.  It has a nifty activity called “Lookup user info”.  The lookup allows you to query a user profile property by their user name.  (There is a screenshot of this on CodePlex)  I am still amazed at how Microsoft doesn’t have this OOTB.  Anyway, this wasn’t the end of the story.

I was interested in finding the real name of the user.  In the query field, I put in “Name” which seemed logical coming from AD, but got nothing back.  I realized it was looking for the Sharepoint version of the user properties.  I then went to the next CodePlex tool, Stramit CAML Viewer.  What an amazingly handy tool!  I then looked up the User Information List under my root URL and found the real name was actually called “LinkTitle”.  In the end with the help of a couple of tools, the email subject had the exact format I needed.  It was “Evaluation form for actual name(LinkTitle)”.

IMHO, Sharepoint and SPD are great together.  However, there are some vital integration pieces Microsoft left out.  I shouldn’t have to go to Visual Studio or open source to convert an AD user name to their “friendly name”.  AD is their product and they should build their products to FULLY integrate with each other in the easiest ways.  That’s my 2 cents and maybe there is another way, but I haven’t found it yet.

#    Comments [0] |
 Friday, April 25, 2008

Arranging editing columns in a DataFormWebPart using Sharepoint Designer

Recently, I was building a training class solution explained here.  After building the solution, I noticed the behaviour of the Edit columns was acting strange.

The Attendees list showed the Edit column.

However, when you click the Edit button, the columns became rearranged.  Notice the save/cancel under the Name heading.

Opening Sharepoint Designer, I found the code where the columns were detailed. Notice the @Author and Sharepoint:FormField are below the dvt_1.automode template call.

To correct the arrangement, copy from the xsl:if to the /xsl:if and move to below the Sharepoint:FormField /td tag.

Now you get the final result (The Title was added later as an extra requirement from our Training Department.)

Click Edit

Now the columns are in the proper order

Hope this helps and thanks to Natalya Voskresenskaya Blog for an excellent solution!

#    Comments [0] |