locked
Cannot filter person field by [Me] or [Current User] RRS feed

  • Question

  • I am using a form library with Infopath forms. Of course all of the fields that are passed to Sharepoint from the form are strings. One of those strings is the currently assigned person's email address. So, easy enough, with a Workflow in SPD 2007 I am populating a new person field with the information from the string that contains an email address. Now, the field (SalesLead), populates great, if i display the field in a view as a name with presence I can click through to their mysite, if I display the person field as an account I get DOMAIN\UserName. If I put a filter on a view where SalesLead is equal to [Me] (thus limiting the amount forms a person would have to sift through to just get to the ones that are important to them) then nothing is return.

    I made sure to try where SalesLead is not equal to [Me] and there pops up all of the forms, including the one test form I have where I am listed in this field!!!

    Thoughts? questions? Please let me know what you think...

    Tuesday, February 22, 2011 11:02 PM

Answers

  • Hi Texrcana,

    Do the account you used to do the test is a System account? It would not work if you use a System Account to do the test.

    You could also add a Current User Filter Web Part in the view page. This will work well even you are using a System Account. Turn to the view you want to add filter to it > edit page and insert current user filter web part > Add connection between filter web part and list people and group column. And filter web part would not affect other views of the list. If you select Account to show in the people and group column, please don’t forget to select SharePoint profile value for current user  to Account name in Modify Shared Web Part window of Current User Filter Web Part.

    Thanks & Regards,
    Emir

    • Marked as answer by Leoyi Sun Thursday, March 3, 2011 3:41 AM
    Thursday, February 24, 2011 7:17 AM
  • Hi Texrcana,

    In your fist post, you mentioned that a workflow is used to update the SalesLead column. But in your latest reply, you update the SP person field with a InfoPath string filed. The column published from InfoPath could not be use to add a filter equal to [Me].

    Please create a People and group column, update this column with the value of the SharePoint column (maybe the SalesLead column) which is the column used to get the value from InfoPath string field. And you can use Update list item action in SharePoint Designer workflow. 

    In short, please try to create a workflow used to update a new People and Group column with the value of SalesLead column. Then add the fiter with the new People and Group column to have a try.

    Thanks & Regards,
    Emir

    • Marked as answer by Leoyi Sun Thursday, March 3, 2011 3:41 AM
    Tuesday, March 1, 2011 11:36 AM

All replies

  • What is happening, is that Presence is smart enough to interpret the email address and send you to the right user.  The field however, is still text.  Make sure that the field definition is changed to be that of SPPerson and then in your workflow, use their DOMAIN\UserName value to create a new SPPerson reference and then populate that reference into the person field.  That should solve the problem.

     


    I trust that answers your question...

    Thanks
    C

    http://www.cjvandyk.com/blog
    Wednesday, February 23, 2011 5:27 PM
    Answerer
  • OK, so I set my field (SalesLead, which is a person field, not a string) to update as DOMAIN\UserName from a newly promoted field in the form and I still cannot filter against this field where it is equal to [Me]. I also added another person field to the library and to the content type, edited the properties, inserted myself and changed the filter to filter on this test field, Assigned. This also did not work...
    Wednesday, February 23, 2011 10:09 PM
  • Hi Texrcana,

    Do the account you used to do the test is a System account? It would not work if you use a System Account to do the test.

    You could also add a Current User Filter Web Part in the view page. This will work well even you are using a System Account. Turn to the view you want to add filter to it > edit page and insert current user filter web part > Add connection between filter web part and list people and group column. And filter web part would not affect other views of the list. If you select Account to show in the people and group column, please don’t forget to select SharePoint profile value for current user  to Account name in Modify Shared Web Part window of Current User Filter Web Part.

    Thanks & Regards,
    Emir

    • Marked as answer by Leoyi Sun Thursday, March 3, 2011 3:41 AM
    Thursday, February 24, 2011 7:17 AM
  • Emir-

    Nice! This did accomplish what I needed to accomplish, however, since these aren't limits on the views themselves, I can no longer allow people to see these views. What I am working on is our Sales site in SP. This site uses infopath so our sales team can easily render client specific proposals based on user input in the form. Until this point I have used the filter on the view, where Created By is equal to [Me], however, when some of the sales team members moved on, it became important to transfer these proposals to existing team members, so filtering on Created By no longer works. I created this new field that gets updated based on the person that is currently assigned to the proposal and have that infopath string field updating the SP Person field, SalesLead.

    While this took care of the site and the web parts in the site, now I can't allow any sales people to view data in the list itself, because I can't place the limit in the view itself. I also had to make the person field display as Account Name instead of the default Name (with presence) and I had to include the SalesLead field in the view to be displayed in the Web Part, so that the Current User Filter to connect and filter on this field. That isn't that big of a deal, but every web part that contains user specific data now has a column that is always the current users DOMAIN\UserName.

    Thanks again, I am using this in the mean time, but if anyone knows why my filter might not work on the view itself it would be much apprecitated!

    Monday, February 28, 2011 7:16 PM
  • Hi Texrcana,

    In your fist post, you mentioned that a workflow is used to update the SalesLead column. But in your latest reply, you update the SP person field with a InfoPath string filed. The column published from InfoPath could not be use to add a filter equal to [Me].

    Please create a People and group column, update this column with the value of the SharePoint column (maybe the SalesLead column) which is the column used to get the value from InfoPath string field. And you can use Update list item action in SharePoint Designer workflow. 

    In short, please try to create a workflow used to update a new People and Group column with the value of SalesLead column. Then add the fiter with the new People and Group column to have a try.

    Thanks & Regards,
    Emir

    • Marked as answer by Leoyi Sun Thursday, March 3, 2011 3:41 AM
    Tuesday, March 1, 2011 11:36 AM