InfoPath Error: Reference to undeclared namespace prefix “dfs”

By | March 17, 2010 | 3 Comments


If you are trying to get/set values using XPath on Secondary Data Source, you might get the error “Reference to undeclared namespace prefix: dfs”.


When you are trying to use XPath expression on Secondary Data Source, you must have to declare the namespace that is going to be used in the code. By default, InfoPath does NOT add namespace for Secondary Data Source. You have to add it manually.


  1. Select the top most element of the Secondary Data Source, right click on it and go to Properties…
  2. Now copy the namespace shown in the image below.
  3. Now in “script.js” file, add the following line at the top where other namespace is defined.

    Please note that “UpdateListItems” is the name of my Secondary Data Source. Replace it with your Secondary Data Source name. Also “dfs” namespace may differ for you so replace it with the namespace you got in Step 2.

About Vishal Monpara

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1's and 0's from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.

3 thoughts on “InfoPath Error: Reference to undeclared namespace prefix “dfs”

  1. suma Chandu

    How to find the script.js file? Is it in the visualstudio(Tools > Programming > Microsoft Script Editor )? or Is it in the infopath ? I am using infpath 2010

  2. Vishal Post author

    script.js file is for the InfoPath form with JScript programming language.
    Now you can go to Tools > Programming > Microsoft Script Editor and it will open up script.js file.
    If you don’t have Microsoft Script Editor option, you probably might not have VSTO installed. Please search on google how to install VSTO for InfoPath.

Leave a Reply

Your email address will not be published. Required fields are marked *