Tuesday, September 1, 2009

Sharepoint designer workflow : Getting data from user and storing it in workflow vari

Sharepoint designer workflows provide a great functionality using its out of the box activity for collecting data from user with in workflow.

When this action is used a form for getting data is created automatically as shown in images below








So if a user want to do some small customization the form will be available to him to do so.
The data collected in response to this action becomes part of task and can be used later in your flow for any decsion or can be utilized in other actions.

For e.g. I used data (comments) from user and update column of my list called comments.

This Action ask you three things

1: Data (Used for desinging question and creating form)
2: User (Used for assigning for to MOSS user)
3: Output Variable (List Item Id for fetching data later)

In my sample I clicked on data and add a field for asking comments from user. Assigned this to appropriate user and set output variable to a newly created variable collect3

I created a new workflow variable of type comments for storing user comments and add another action Set Workflow Variable for initializing my workflow variable with information provided by user.

Action set workflow variable provide two fields Workflow Variable and Value
I slected comments Varaible in workflow variable. Now real issues came when I need to pull up comments from my workflow form using list Item Id.

I performed following steps.
(Please note before moving ahead save your workflow by clicking on finish and repoen it by clicking on xoaml file)

1. Click on value
2. Selected Task in source
3. Selected Field "Rejection Reason" (This was the same field that I defined in my form earlier for collecting data from user)
4. It gives me two more option to select In Field I selected "Task:ID"
5. In Value I selected the WorkflowData -> Collect 3 (Same variable I used to kept the reference of my comments field)
as shown below


Now after defining above I managed to initialize my workflow variable with details collected from user in middle of workflow execution.







3 comments:

  1. Error updating a list item :(
    Iam getting errors when i use "Update Item in Task"

    Prashanthspark

    ReplyDelete
  2. Are you getting your form data in your variable correctly or not.

    Is it happend when u save your form value in column of your list?

    ReplyDelete
  3. Thanks, very helpful blog,....

    you should join Microsoft man :)

    ReplyDelete