I have a list in SharePoint 2013 called 'Product'. I want to create a purchase form in InfoPath 2013. enter image description here

I have created to look up in infopath for product code from sharepoint list. But I want the unit price to fill in automatically in infopath when I select product code.

How we can do it? please guide.

enter image description here


You need to create a new data connection to the Product list. That connection must include the Product Code and the Unit Price. Let's call it ProductPriceList.

Then create a rule on the Product Code drop-down that fires when the Product Code changes.

The actions of the rule are:

  • set a field's value: ProductPriceList data connection > Query fields > Product Code to the value selected in the Product Code control
  • query the ProductPriceList data connection. The data connection will now return just the one record for the matching product code.
  • set the Unit Price field in the current form to the Unit Price from the Data Fields of the ProductPriceList data connection.

Edit for clarification: Make sure you set the field view to Advanced View. Here is a screenshot of a secondary data connection to a SharePoint list. It has different fields than yours but the same principle applies. Just imagine that instead of State, Region and ID it says ProductCode, UnitPrice and ID.

enter image description here

You should see your Product Code and Unit Price fields in both the queryFields and the dataFields nodes.

In the first action of the rule you need to set the value of the Product code in the upper node, the queryFields.

Then query the data source. That will return all items with that product code to the dataFields node. If the product code is unique, it will return only one item, and that is the item you want.

Now set the value of current form's Product Code field. Set it to the Product Code from the dataField node.

  • I've created a data connection as Product including Product Code and Unit Price. But on setting the rule part I really don't get it. Do you have any guideline that you e-mail me? – Yuges Jan 7 '16 at 5:14
  • I've added a screenshot and some more explanation. – teylyn Jan 7 '16 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.