InfoPath Reference to Undeclared Namespace Prefix: ‘PC’

If you’re working with the Person/Group Picker in InfoPath, and you are using the Eval function to do some concatenation of the individuals selected (see this blog for an example usage) you may have come across the following error:

Reference to Undeclared Namespace Prefix PC

The blog I referenced above even has several individuals pointing out this error in the comments, but there is no resolution to the issue. I came across this same problem, and was fortunate enough to discover the remedy.

How to Recreate the Problem

  1. Design a new “Blank” InfoPath form
  2. Add a Person/Group Picker to the form named “People” and configure the control for SharePoint and multiple selection
  3. Add a Textbox to the control, whose default value is the following formula (Edit XPath):
    xdMath:Eval(xdMath:Eval(../my:People/pc:Person, ‘concat(pc:AccountId, “|”)’), “..”)
  4. Verify the Formula
  5. In InfoPath 2010, you should receive the above error (Reference to Undeclared Namespace prefix: ‘pc’)

How to Solve the Issue

  1. Cancel your formula
  2. Save your form
  3. Close InfoPath
  4. Reopen your form in InfoPath
  5. Reinsert the formula into the default value of your Textbox
  6. Verify the formula
  7. You should no longer receive the error

Summary

At the heart of the issue seems to be InfoPath’s inability to recognize the new ‘PC’ namespace from the Person/Group Picker control until it has closed and reopened the form. This is a quick fix to the problem, and I hope that this information was able to assist you.

Cheers,
Matt

Add a Comment

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