.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

SharePoint And InfoPath - Using Lookup fields

Posted By:Jean Paul       Posted Date: September 29, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

While using SharePoint & InfoPath, one might encounter problems in saving the data on Lookup Fields. Here we can explore a solution to solve it

While using InfoPath Form for a SharePoint 2010 List > I encountered the following error.

InfoPath cannot submit the form because it contains errors.


Cannot be blank.

Failed Solutions

I tried with the following approaches & Failed:

  1. Manually created the field from InfoPath & Assigned Validation Rule.  Failed as Validation rule was not enabled for the field
  2. Removed mandatory check box for the field.  Worked but customer requires the field to be mandatory. Failed.


Following are the 2 lists included:

  1. Contracts list with Customer Name field & Product Code field pointing to Products list
  2. Products list with Code field

Concrete Solution

  1. The following approach worked:
  2. Removed the field from SharePoint
  3. Created the field from InfoPath
  4. Used Choice field with multiple values
  5. Used Data Connections to Populate field value
  6. Published & Tested
  7. It worked


Following are the steps to implement the Solution.

Step 1: Delete existing field

Delete  the field from SharePoint.  Save Changes.

Delete the field-row from InfoPath Form.  Save Changes.


Step 2: Add Field from InfoPath

Create the field from InfoPath. 


Choose Actions > Add Field

Choose Data type > Choice (allow multiple selections)

Choose Mandatory option

Click OK button to save changes.

Step 3: Add Field to Form

Right click and add a row to InfoPath form.


Drag & Drop the new field Product Code from the fields list to the form.


Step 4: Add Data Connection

Now the new field & control is missing data-population.

To add a data connection > right click the product code input-area & choose Properties menu.


In the appearing Properties box > Choose Get choices from external data sources option.


Click on the Add button to create the data source.

Choose the options as shown below.



Choose your SharePoint site as shown below.


Choose the Lookup List.  (the secondary list from where data is pulled)


Choose the fields to display.  (In our case only Code field exists)


Enter the name for the data connection.  (You may use the Suffix as DS)


Click the Finish button to save changes.


Step 5: Save & Publish

Click the Save button & Publish the form


Step 6: Test the form

Test the form by adding a new item.  You should see the item insertion succeeded without any errors.


You can try with multiple-value checking & getting displayed in the view mode too.


This concludes our solution to Lookup field error in InfoPath forms.  I hope you enjoyed  the solutionv

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend