Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007 (part 8/20)

 

image

 

 

By Serge Luca

MVP

image

 

 

step16
step17 

Step 8/20. Bringing data from the workflow to the task form

Download the code

Scenario

The manager needs all the necessary information to approve or reject the expense report; therefore we need to display the expense report data into the task form.

Hands-on

Start from step 7 solution.

Open the Infopath task form ( ApproveReject.xsn) in design mode .

Update the form like this:

 

Rename the controls in order to have the following Data source:

The content of these extended properties will be sent to the Infopath Task form.

Create the following .xml file and name it ItemMetadata.xml (Spelling and capitalization must be exactly the same here: both for the file name and for the  extended properties name, each must be prefixed with ows_):

Click on the ApproveRejectTask activity and add 3 new extended properties to the ApproveRejectTaskproperties:

 

Add a new Data Connection to link the infopath form to this xml file:

  Click on Next:

 

Click on Next and select the .xml file:

 

 

Click on Next and select the first option :

 

Keep the default options and click on Finish.

Now we are going to bind the form field to the new Data Connection fields:

In the task form, click on the submitter field :

 

 In the data panel, click on the formula (fx) button:

Click on the  insert field or group button and switch the Data source to ItemMetadata (secondary):

Select ows_submitter :

Click Ok.

Repeat this for the amount and the description fields.

Save and publish the form; make sur the published template is in your project folder.

Rebuild the solution, call install.bat and test the workflow by following the next scenario:

Add a new user account : Jon; Jon will be Bill’s manager.

 

Log in as Serge (Serge’s manager is Bill, not Jon) and submit the following expense report:

Start the workflow: normally Serge’s manager is Bill; if Bill is on vacation,serge will submit the expense report to Jon:

 

A task will be assigned to Jon:

If Jon clicks on the task hyperlink:

 


This hands-on training is the property of Redwood S.L sprl and may not be organized in class or in group without the prior written permission of Serge Luca. Should you wish to organize this hands-on training in your company or institution, please contact Serge Luca  first to enter into a licence agreement. Each trainer or teacher using this hands-on training should have a licence agreement. Please ask your trainer or Serge Luca whether he or she has entered into a licence agreement with Redwood S.L sprl.

The hyperlink to this hands-on training may be placed on your website for free, on the condition that the name Serge Luca is clearly mentioned in the reference. Please send us a mail containing the link to the web page our reference is used on.


Advertisements

3 responses to “Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007 (part 8/20)

  1. To help everybody knowing what\’s meant with "add 3 new extended properties":
     
    this.ApproveRejectTaskProperties.ExtendedProperties["submitter"] = SubmittedBy;this.ApproveRejectTaskProperties.ExtendedProperties["amount"] = Amount;this.ApproveRejectTaskProperties.ExtendedProperties["description"] = Description; 

  2. if the user not jon open the task hyperlink,
    will the task be edited or updated by that person even the task is not assigned to them?
    i found that my workflow will allow anyone to update the task even the task not assigned to them.
    how can i control this?
     
    thanks.

  3. Thanks for the nice example. I\’m able to get data into the task form with the exception of the "Assigned To" value. I\’ve added:
     
      ows_Assigned_x0020_To=""
    to the ItemMetadata.xml file, but the value isn\’t returned to the form. Any thoughts on how to get this field into the task form?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s