Force form to open with newest template version - InfoPath Dev
in

InfoPath Dev

Force form to open with newest template version

Last post 02-11-2010 12:32 PM by zxkuqyb. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-22-2005 06:19 PM

    Force form to open with newest template version

    I posted this question out on the microsoft.public.infopath newsgroup but haven't got any good responses back yet and am hoping someone in this forum may know the answer:

    I have developed an InfoPath form that will probably require some
    changes over time, both to the main data source as well as minor text
    and image changes after its initial deployment. I would like to know
    how to force forms that were created with an older version of the form
    template to always open in the latest version of the .xsn that is
    published on my web server. I have the On version upgrade setting set
    to "Automatically upgrade existing forms" (Form Options > Advanced) but
    it seems that the only way for a user to get the newest version of the
    form is by filling it out as a new blank form.

    Here is the process that I am currently using:

    Users fill out a new form from the .xsn that I publish to a web server
    on our company intranet (i.e.http://server/vdir/form.xsn) and it is
    launched using Sharepoint OpenXMLDocument ActiveX scripting in an .aspx
    page. When a new form is submitted, a web service that I have written
    receives the entire XML from the form and creates an .xml file in a
    folder within that virtual directory on the server. The web service
    then sends an email with a link to open the form. The link in the email
    message points to that same.aspx page which has logic to open the
    specific .xml file (passed in the querystring) instead of a blank form.
    I've included a bit of the code below.

    Here is an example of the problem:

    1. User A fills out a form using version 1.0.0.0 (solutionVersion) of
    the template. All is well.

    2. User B fills out a form, however the form has been republished and
    is now at version 1.0.0.1. All is well.

    3. The form User B filled out needs to go to User A via the email I
    mentioned. But if User A has never filled out a form using version
    1.0.0.1, the message they get is "This form was created with a new
    version of the form template. InfoPath cannot open the new version. Do
    you want to open with the older version?" User A can click yes and the
    form MAY open with the template version they last used, depending on
    the compatibility between forms. But even if it does open, it may not
    appear the way I would want it to because it is the older version.

    As I mentioned the workaround is to have the user close infopath and
    then open a blank form as if they were going to fill it out. They can
    then close and go back to the .xml file and it opens in the newer
    version.

    I don't think the code I am using really has anything to do with the
    problem, but more that this may be just the way that InfoPath handles
    version differences. Does anyone have any suggestions?

    <%
    ' Are we opening an existing form or creating a new form....
    Dim formFile
    formFile = Request.QueryString("f")
    If formFile = "" Then 'no filename specified, fill out a blank form
    formFile = "nurf.xsn"
    Else
    formFile = "/files/" & formFile 'The forms are stored in the
    'www/files' folder
    End If
    %>
    <html>
    <head>
    <title>Form Loader</title>

    <script language="JAVASCRIPT">
    function createForm()
    {
    try
    {
    //Create an instance of the OpenXMLDocuments object.
    //document.getElementById("loadmsg").innerHTML=
    'Opening NURF form, please wait...';
    var xmlDocObject = new
    ActiveXObject("SharePoint.OpenXMLDocuments.1");
    var strTemplate = "http://MY_SERVER_NAME/nurf/<%=formFile%>";
    var strSaveLocation = "http://MY_SERVER_NAME/nurf/";

    if (!xmlDocObject.CreateNewDocument2(window, strTemplate,
    strSaveLocation)) {
    document.getElementById("errormsg").innerHTML = "<b>ERROR
    OCCURRED</b><br/>The call to the
    SharePoint.OpenXMLDocuments::CreateDocument2 method failed!";
    }
    else
    {
    window.history.go(-1);
    }
    }
    catch (e)
    {
    document.getElementById("errormsg").innerHTML = "<b>ERROR: " +
    e.message + "</b><br/>Is InfoPath (and Microsoft Office 2003 with
    Service Pack 1 installed?)<br/>If you have any questions please contact
    the help desk";
    }
    }

    -->
    </script>
    ...
    <!-- More HTML here to call the createForm() function and other stuff
    -->
    ...
  • 12-23-2005 07:07 PM In reply to

    Re: Force form to open with newest template version

    Hm, I wonder why does InfoPath say "cannot download the newest version" ? Shouldn't it download the newest version everytime? Maybe when the web service rewrites the XML it leaves something out. Would it be possible to have an example of the XML file before and after the web service touches it?

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 02-11-2010 12:32 PM In reply to

    • zxkuqyb
    • Not Ranked
      Male
    • Joined on 01-14-2009
    • Indianapolis, IN
    • Posts 18

    Re: Force form to open with newest template version

    I have the same issue...very frustrating.  Wondering if it's a bug somewhere in SharePoint or InfoPath?

     

    Thomas N. Barrett

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