Workflow Soluiton

 View Only

How to Use the "Current Logged on User" Information on Any Web Form 

Sep 24, 2010 01:25 PM

The following is just the basic instructions for utilizing the "Get Current user" component and combining it with the "Get users With Details" component.  Having this information at the beginning of a workflow can be valuable later when creating forms and pre-populating some information.  It can also be used to respond bay to the "form" submitting user, information about the process.

The process I use is as follows:

  1. Create New Workflow
  2. Set it to a Form Start Workflow in the publishing tab within the Workflow properties
  3. Setup the Notification Server Credentials component that will be default in all Workflows (may not need this depending on your situation)
  4. Add my additional components
  5. Create any Web form and use the available Process Variables

We will assume steps 1-3 are done at this point as they are the most basic parts of this

Setup

At this point you can start to add the components to capture some information automatically about the person filling out and submitting the form that you will create.  

Click on the Import Components button below the toolbox.  This is where the Active Directory library will be added from.  Highlight ActiveDirectory.dll, click the Add button and click on OK.  Adding this dll will allow for the use of some specific components to be added in further steps.

Add the following components in order after the Create NS Credentials.

  • Get Current User
  • Split Text Into Collection
  • Get Users with Details
  • Copy Data Element to new Location

Take a copy of the end component and separate the "Not Found" and "Error" outputs of the Get Users With Details component to the new End component.  This will just keep the Workflow clean by showing negative path's in a different direction.

Now that the Get Users with Details has been added, additions of AD authentication have been added to the global properties of the project.  Input the correct information for AD server, username, password, domain.

Configure

Configure the Split Text Into Collection component.  The Get Current User component will grab the logged on user, but in a format we can't really use.  It grabs Domain\UserName and we really only need Username.  

  1. Set Text To Split to process Variable "CurrentUser"
  2. Set the Delimiter to "\"
  3. Set the Output Variable name to something like "ActualUserName"

 

Configure the Get users with Details component to use the ActualUserName process variable.

  1. On the input tab, set the Search Type to "Set of Fields"
  2. Configure "user name to a process variable of ActualUserName[last]

This will pull the second part of the split username (domain\username)

 

Configure the Copy Data Element to New Location to capture all of the Active Directory information about the current user. 

  1. Set the input to FoundUsers[last]
  2. Set the output to something like CurrentADuser

This will allow for all information of the user to be available downstream in the workflow

 

Additional Requirements

There are a few things that you must do so that the Workflow can detect the user. 

  1. Publish the project
  2. Edit the web.config "Authentication" to "Windows"
  3. Within IIS Manager, you will need to right click the project website - choose Properties - Choose Directory Security - Click the top "Edit" button - remove the "Enable Anonymous Access checkbox - check the Integrated Windows Authentication checkbox and click OK - Apply
  4. Reset IIS

Details on step 3 can also be viewed on Workflowswat - HERE

Summary

Within the Process Variable "CurrentADUser" lies all of information that is populated within the Active Directory User account.  

Examples:

  • email address
  • office location
  • phone number
  • title

What can you do with this information within a web form now?

You can pre-populate a webform with something like "Hello CurerntADUser.CommonName" as well as add an email component to send summary information to the person submitting the form using the CurrentADUser.emailaddress in the To: field.

 

There are many more options with this as well, as long as the information is there within the AD account

 

Here is a screenshot of my structure. 

 

 

Please let me know if I have left anything out or if you have any problems or questions regarding this article.

 

 

 

 

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Dec 08, 2010 02:08 PM

I don't see the input and output fields for the "Copy Data Element to New Location" component you mention.

In addtion, you may want to include ASP.NET configuration authentication is set to Windows and lastly, reset IIS.

Related Entries and Links

No Related Resource entered.