Lookup sharepoint list and set fields value in InfoPath - InfoPath Dev
in

InfoPath Dev

Lookup sharepoint list and set fields value in InfoPath

Last post 03-05-2013 04:01 PM by bryang. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-16-2012 10:53 AM

    • JimiH
    • Not Ranked
    • Joined on 06-15-2012
    • Posts 18

    Lookup sharepoint list and set fields value in InfoPath

    Hello I have two SharePoint lists the first "Customer" has the fields Company and Contact. The second "Orders" is a order list with details of orders. I have created two data connections for the two lists. On my test InfoPath form I have two fields, one returns the Username of the person viewing the form, Username() function. The second field I want populating with the company that the user belongs to. So the workflow is this. A user opens the form, the username field is populated by the username function Username(). The second field gets the username value and queries the the customers list to find the Company value. I can get the values into a dropdown box but when I add the filter I return no values? Please help Thanks Geoff
  • 06-17-2012 01:46 PM In reply to

    Re: Lookup sharepoint list and set fields value in InfoPath

    JimiH:
    I have two SharePoint lists 

    the first "Customer" has the fields Company and Contact. 

    The second "Orders" is a order list with details of orders. 

    I have created two data connections for the two lists. 

    On my test InfoPath form I have two fields, one returns the Username of the person viewing the form, Username() function. 

    The second field I want populating with the company that the user belongs to. 
    So the workflow is this. A user opens the form, the username field is populated by the username functionUsername(). 
    The second field gets the username value and queries the the customers list to find the Company value. 

    I can get the values into a dropdown box but when I add the filter I return no values?

     

    If your customers are sharepoint users, as follows from your question, then you do not need any custom and/or additional lists and/or structures since you can put and use in-built user profiles with dozens of related fields there

    Cf. my reply how to get current user name (or other her fields like her department, office location, e-mail) 

    Also, I could not grasp how and by which your  Orders list is related to what you have asked.

    So, in order to get the company of current user, I created

    Customers list with fields:

    • CustomerName (renamed from Title, shouldn't a customer be identified somehow?)
    • CompanyName
    • Contact
    • etc, never mind

     

     

    Filled it with (some) data

    In Infopath Designer 2010 created (File --> New -->)  Blank Form

    Put there  "Text Box" control, data connection to Customers list (called it for me CustLst)


    Text Box Properties:

    Default value: 

    Pressed fx button --> clicked "Insert Field or Group..." button --> under CustLst (Secondary)  chose CompanyName (under dataFields --> d:SharePointListItem_RW)

     

    Pressed "Filter Data..." button

     

    • under left drop-down-list, chose CustomerName
    • "is equal to"
    • under right drop-down-list "Use formula..."
      • "Insert Function..." --> User --> userName --> OK

     

    Well, pressed OK half-dozen times

    Formula looked as:

    • CompanyName[Title = userName()]

     

    Note I renamed Title field to CustomerName but it dropped back to insist on Title anyway
    (guess I wouldn't make it in code) 

    F5 --> Yes --> Worked like a charm for me

     

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 06-28-2012 08:39 AM In reply to

    • JimiH
    • Not Ranked
    • Joined on 06-15-2012
    • Posts 18

    Re: Lookup sharepoint list and set fields value in InfoPath

    Thanks that worked perfectly.

    Geoff

  • 03-05-2013 04:01 PM In reply to

    • bryang
    • Not Ranked
    • Joined on 07-25-2011
    • Posts 2

    Re: Lookup sharepoint list and set fields value in InfoPath

    Hi Gennady, I have a similar problem which I am unable to resolve; Three lists on SharePoint 2010; - Clients master - Projects - Log I want a user to add a log entry about a project. Using InfoPath, I have modified the form. Now, they can select a client from the Clients master list, this then filters the next drop-down box of projects by that Client - great. I now want to retrieve the corresponding 'Project Owner' and 'Project Manager' fields from the Projects list and have this recorded in the Log list. I seem to be struggling around the two fields being people fields. If I try to add the people picker control from the list of fields in the Log list, I can't change any of the fx options. I've tried using a text box in the Log list but it complains about getting data from a repeating field (people) and putting it in to a non-repeating field (text box). Any suggestions would be greatly appreciated! Thanks, Bryan
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.