OnVersionUpgrade

M

Mike G.

I've seen others post about this issue, but I haven't seen an answer yet.

I am looking into deploying a new version of a form. The change is that a
new field has been added, and when the user opens the form for the first
time, I'd like to programatically look up some data in a database based on
values in the form and populate the new field.

So, I set up the onversionupgrade event, following the example from MSDN.
However, when I run it, I get:

"Element 'fieldname' is unexpected according to content model of parent
element".

Any suggestions?

code follows:

if (!XDocument.DOM.selectSingleNode("//my:fieldname"))
{
try {
// Create the new element.
var objItemNode = XDocument.DOM.selectSingleNode("//my:myFields")
..ownerDocument.createElement("my:fieldname");

// Add the new element to the XML document as a child of the element.
XDocument.DOM.selectSingleNode("//my:myFields") .appendChild(objItemNode);
eventObj.ReturnStatus=true;
}

catch(ex) { XDocument.UI.Alert("blah blah"); eventObj.ReturnStatus=false; }


Thanks,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top