Migrating 2003 form to 2010 - newfromsolution and dataconnections - InfoPath Dev
in

InfoPath Dev

Migrating 2003 form to 2010 - newfromsolution and dataconnections

Last post 07-11-2012 11:50 AM by TerryB. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-10-2012 10:50 AM

    Migrating 2003 form to 2010 - newfromsolution and dataconnections

    Hi,

    I'm currently migrating a number of 2003 developed forms (call them AQG and CAV), which have lots of jscript in them, to IP & SP 2010. The jscript in AQG has a couple of lines of code that opens a new form (CAV) & passes data to it - see below (to maintain the code I'm extracting the form files and editing script.js.

    Code in AQG 

    var fred = Application.XDocuments.NewFromSolution("\\\\coportall\\sites\\bill\Caveat Form\\Forms\\template.xsn");

     // set caveat waiver DOM 
     var MyFormDOM = fred.DOM;
     MyFormDOM.setProperty("SelectionNamespaces", "xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-03-08T17:07:59\"");

     // Copy the values from the AQG to the CAV form
     MyFormDOM.selectSingleNode("/my:myFields/my:Originator").text = Originator; 
     MyFormDOM.selectSingleNode("/my:myFields/my:Originator/@my:Email").text = OriginatorEmail; 

    //etc. etc. - lots of stuff copied across.

    =======

    The form I'm opening via the NewFromSolution (CAV) has some other data connections that refresh on opening (incidentally, CAV opens fine if opened direct or by using a button with an action fromAQG).

    This all works fine until I publish the form (CAV) in SP as a 2010 filler form and update the data connections to current version i.e. create the query and data field elements of the data connection.

    The code above then ceases to work - the error I'm getting refers to invalid parameters on dataquery when the form attempts to open.

    I'm wondering if it's anything to do with namespaces etc. and have been trying some things, but can't get it working..

    Any suggestions would be appreciated.

    Orlando A Battista : An error doesn't become a mistake until you refuse to correct it.

    Terry

  • 07-11-2012 11:50 AM In reply to

    Re: Migrating 2003 form to 2010 - newfromsolution and dataconnections

    Issue resoved :-

    doesn't work :-

    var fred = Application.XDocuments.NewFromSolution("\\\\coportall\\sites\\bill\Caveat Form\\Forms\\template.xsn");

    but

    var fred = Application.XDocuments.NewFromSolution("http://coportall/sites/bill/Caveat Form/Forms/template.xsn");

    Looks obvious but the first fred has worked in IP03 for 2 years, but it doesn't work in IP10. I think the issue might be that IP10 uses the passed xsn url in some way when it does it's data connections that refresh on form open, where IP03 doesn't. But of course I might be completely wrong!

    Regards,

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.