Search This Blog

Friday, May 6, 2011

Filtering SharePoint List Data using Infopath 2010

I could have just added the Account field to the Custom List data source (and I did that, from Tools > Data Connections) and used that instead of the Name field, but people usually don't know their managers' account names. I did a little digging and found an MSDN forum post that gave me a great way to let users pick friendly display names, which InfoPath would then use to populate a hidden form field with the corresponding account name

  1. Add a Text Box field to the InfoPath form (Insert > Text Box).
  2. Right-click the text box and choose Text Box Properties.
  3. On the Data tab, click the Function (fx) button in the Default Value section.
  4. Click the Insert Field or Group... button.
  5. In the Data source drop-down list, select Your Custom List.
  6. Expand the folders until you see the fields in the User Information List.
  7. Click the :Account field (you did add it from Tools > Data Connections > Modify, right?), and then click Filter Data.
  8. In the Filter Data box, click Add.
  9. In the Specify Filter Conditions box, select Name in the first field, is equal to in the criteria field, and Select a field or group in the third field.
  10. In the Select a Field or Group box, change the Data source to Main (this is your InfoPath form fields).
  11. Click the field that contains the drop-down list of display names you created earlier, and then click OK.
  12. Click OK in all the dialog boxes (shown below) to return to the Text Box Properties.

Hiding Form Controls

I wanted the field hidden, since users didn't need to see it, so back in my Text Box Properties:
  1. In the Display tab, click Conditional Formatting.
  2. In the Conditional Formatting box, click Add...
  3. In the condition builder section, leave the field name selected in the first box, and then select is present in the criteria box.
  4. Check the box Hide this control, and then click OK.
  5. Click OK to return to the Text Box Properties, and then click OK to save

Click Preview one more time to make sure I can't see the field containing the account name anymore - success! Finally, I walked through the File > Publish wizard one last time, making sure to add my new hidden Text Box field to the list of fields to publish, and I was ready to go. Users could create their expense reports in a Forms Library;


  1. this is a good idea. I am trying to figure out how to implement this in a way that I can filter a sharepoint list based on user entry. then populate a dropdown based on that filtered source. Any suggestions?

  2. Right here is the right web site for anybody who would like to find
    out about this topic. You realize a whole lot its almost tough to argue with you (not
    that I actually will need to…HaHa). You certainly put a fresh spin on a topic that has
    been discussed for ages. Great stuff, just wonderful!
    my website: diet that works

  3. Wonderful blog уou havе herе but І was wanting to know if you knew of any discussion boards that cover the same topiсs tаlked about in
    this аrtіcle? I'd really love to be a part of community where I can get comments from other experienced people that share the same interest. If you have any suggestions, please let me know. Bless you!

    Here is my web blog: en yeni oyunlar

  4. Υou reаlly mаke іt ѕeеm sо easy ωith youг pгesеntation but I find this mаtter to be really
    sοmethіng that I thіnk I would neѵer understanԁ.
    It seemѕ too complicated аnd veгy broаd for
    mе. I'm looking forward for your next post, I will try to get the hang of it!

    My blog :: bulma oyunları

  5. Very nice post. I just stumbled upon your weblog and wanted tο mention that I have reallу enjoyeԁ
    suгfing агound yоuг blοg posts.
    In any case Ι'll be subscribing for your rss feed and I hope you write once more soon!

    my homepage :: ev oyunları