Submit Using Code due to Timeout Error - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Submit Using Code due to Timeout Error

Last post 07-08-2009 08:49 AM by Danielle. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-12-2009 01:04 PM

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    Submit Using Code due to Timeout Error

    I have an Infopath form that is submitting to a database and SharePoint 2.0.

    This form and process is well over a year old.  I have been fighting a battle because SharePoint is timing out on our submits during heavy network traffic.  Today I received an email that I need to change the submit to be code and to add XDocument.QueryAdapter.Timeout = 120; XDocument.QueryAdapter.Query(); to the submit code.

    I have not written any code for this form in the past and I am really not sure where to start.  I have been using rules and the two dataconnections to submit.  So my questions are:

    1. Is there somewhere to change this code without having to rework the submit process?

    2. If not, What should the code look like, currently the code submits to an HTTP: address for SharePoint and to the "Main Connection" which is the database.  The form is also autonamed on Sharepoint using the ConCat function:concat(@Customer_Legal_Name, @Date_Requested)

    3. To submit to the database do we have to map each field back?

    4.  Is there code to submit using data connections and still be able to use the timeout settings above?

    Any help would be greatly appreciated.

    Danielle
  • 05-12-2009 07:01 PM In reply to

    Re: Submit Using Code due to Timeout Error

    Hi Danielle and thank you for the thorough and thoughtful question! You've obviously done your homework.

    Your intuition is correct. Less code means less maintenance cost for you. Zero code forms are the best.

    Why is your form taking long to submit? Does your form have images or attachments? Is it a server issue? That would be the root cause. Addressing the root cause is always better than just doing the workaround.

    There are many workarounds:

    1. Add the timeout code. We can do this for you. It takes <30 minutes to add this to your form. You can donate some $$, send us the XSN, and we'll do it for you. That's one option.
    2. Reduce the size of the submitted form using something like our free qRules library (which is code, but comes with an "injector" so you don't have to write or develop it). qRules can be used to offload images to separate ShP libraries so the form size is reduced and your submit time shortened.
    3. Use a faster Web Service to submit. SharePoint is slow. Qdabra's Web Service (DBXL) can be used to speed up submits. However, this won't have much of an impact if the XML data is large (>500kb on average). Here's a link to comparison of using Web Service vs. SharePoint: http://www.infopathdev.com/blogs/ernesto/archive/2009/01/07/dbxl-v2-3-performance-analysis.aspx. Why is SharePoint slow? Good question since it's just a set of Web Services itself. Ask Microsoft! :)

    You also asked about submitting to a database. Do you mean the SharePoint database? If you save to SharePoint or to our Web Service the XML form's promoted properties will automatically be mapped to the SharePoint form library.

    You can definitely use data connections to submit to a Web Service. No code needed there.

    Let us know how we can help.

    Good luck!

    Patrick Halstead
    Project Manager at Qdabra
  • 07-08-2009 08:49 AM In reply to

    • Danielle
    • Not Ranked
      Female
    • Joined on 02-17-2009
    • North Carolina
    • Posts 12

    Re: Submit Using Code due to Timeout Error

    Good Morning,

     After two months to have time to work on this, I finally got it.  The code is:

    function CTRL2114_7::OnClick(eventObj)

    { try

    { XDocument.QueryAdapter.Timeout=240;

    XDocument.QueryAdapter.Submit();

    XDocument.DataAdapters["MainConnection"]

    XDocument.DataAdapters["Submit"] .Submit();

    XDocument.UI.Alert("Document submitted successfully.");

    eventObj.ReturnStatus = true;

    XDocument.SetDirty(false);

    XDocument.View.Window.Close(true); }

     catch(ex)

    { XDocument.UI.Alert(ex.description);

    eventObj.ReturnStatus = false; }

    }

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