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