Who Am I?

Many times I’ve seen organizations that use InfoPath forms make users fill out the same information about themselves for every request:  name, phone, email, office location, etc.   Call me lazy, but I don’t like to fill out that same information every time.  Besides, what’s more embarrassing than putting a typo in your own name?


I usually create a general SmartObject for this purpose.  General SmartObjects aren’t a K2 concept but a convention I use.  I typically divide SmartObjects into two types:  general and project specific.  General SmartObjects are broadly applicable to many different projects and processes; I name them accordingly.  Specific SmartObjects, while they could be used in other projects, are usually pretty specific to a process.  (There are two kinds of people in this world:  those who divide SmartObjects into two types, and those who don’t).

The general SmartObject I use most is the one that retrieves user and group information from the ActiveDirectory2 service.  In fact, the one I use looks like the one in the “Creating Active Directory SmartObjects” topic starting on page 131 of the K2 book.  Among other things, I use this one to retrieve information about the current user and populate that in the InfoPath form when it opens.

 

I integrate this Users.GetUserDetails SmartObject method into the InfoPath form using either the process wizard in Visual Studio, or by right-clicking on the XSN file and using the integration menu.  In the form’s Open rules I set a condition to make sure it only queries the SmartObject when the initial view is shown.  Then I set the SmartObject input UserName to the InfoPath username() function and query the SmartObject. 

 

Put the fields you want to display on the InfoPath form in read only mode and move the fields from the secondary data source.  Now your users won’t have to enter their information  every time they open the form.  The screen show below shows the information on the InfoPath form along with the corresponding AD entry.  Of course, this information is only as current as the data in ActiveDirectory.  We all keep that current, right?  Right?


 


Posted Mon, Apr 20 2009 2:29 PM by DavidL