This article is a continue on the previous article "HOW TO Populate a List with the SharePoint Users"
Download
To download both articles, please click on the following link:
HOW_TO_Populate_a_List_with_the_SharePoint_Users.pdf
Problem
When publishing the previous form to SharePoint, and you promote the field Assign To, you will notice the newly created column is of type: Single line of Text.
Figure 3: View of columns.
When you want to filter this view, using [Me], you will receive an error
Figure 4: Edit View page, Set Filter.
The error you receive is: The value is not a valid text string
Figure 5: Error Message.
Solution
In general, we need to add a new column and create a SharePoint Workflow with the SharePoint Workflow Designer
- Add a new column to the View
- Open the Form Library Settings page
- Click on Create Column in the Columns Section
- Enter Assign To User as Column name
- Select Person or Group as the type of the column
- Click on the Ok button
- Create Workflow
- Open the SharePoint Designer
- Create a new workflow (Menu File ->New -> Workflow)
- Set the workflow name: SetAssignToUserField
- Select the SharePoint list where the workflow should be attached to
- Select Automatically start this workflow when a new item is created checkbox
- Select Automatically start this workflow when a new item is changed checkbox
Figure 5: Define Workflow, step 1.
- Enter the Step 1 name: SetAssignToUser
- Select Set Field in Current Item under the Actions
- Click on Field and select Assign To User (the newly created column in the SharePoint View)
- Click on Value, click on the Display Data Binding Fx button
- Select Current Item as Source
- Select Assign To in the Field dropdown box
Figure 6: Define Workflow Lookup Dialog Box
Note that we just link the Assign To field (Created by InfoPath and keeps the User ID) to the Assign User To column, which is of a Person Group type.
SharePoint will execute the lookup automatically and will shows the Display Name in the view
- Click the Finish button
- Add the filter
- Go back to the SharePoint List
- Modify the Current View
- Select Show Items only when the following is True radio button, under the filter Section
- Select Assign User To from the Show the items when column dropdown box
- Enter in the value textbox [Me]
Figure 7: Filter Settings of the View
- Click on the Ok Button
9 comments:
Nice post as it is something I already do and was about to write my own blog entry before someone pointed to this. I think it is all good except for the potential of an infinite loop in the workflow. I've reference your blog entry from my blog while adding additional concerns and info:
http://claytoncobb.wordpress.com/2009/06/29/using-me-to-filter-infopath-form-views-based-on-form-metadata/
Thank you very much.
All the way from Kenya
Perfect solution, thanks a million... done and done.. took me ages to realise that it won't filter on a single line of text when I was populating it from the workflow.. cool, thanks. :)
I tried this solution and got Workflow Error. (Unknown error) Can anyone please assist considering that the error does not provide much info.
Brillant !!
It's save my sharepoint !
Thank-you, this was exactly what I needed!
thank u very much, it is very helpful
Thank you! This helped me out even 7 years later on SharePoint 2010.
Post a Comment