How call two connections data after send form? - InfoPath Dev
in

InfoPath Dev

How call two connections data after send form?

Last post 04-04-2006 07:02 PM by Shiraz Cupala. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-13-2006 06:26 AM

    How call two connections data after send form?

    Friends, I do not know to program and necessary of aid.
    How I write a code for after to press the button "to send" to call two connections data "sendSharepoint" and "sendEMail" ???

    I am using in "script.js" the stretch of codígo below:


    function XDocument::OnSaveRequest(eventObj)
    {
    //It writes the code to be executed before saving here.

    eventObj.IsCancelled = eventObj.PerformSaveOperation();

    //It writes the code to be executed after saving here.

    eventObj.ReturnStatus = true;

    }

    Necessary that when sending the form, it executes the two data connections that already I prepared (sendSharePoint and sendEmail).

    Thanks!!!
    Leandro Lucena - Brazil.
  • 03-18-2006 06:35 PM In reply to

    Re: How call two connections data after send form?

    Hello,

    please check this MSDN article
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ip2003_ta/html/odc_InfoPath_submitting_forms.asp

    Check the code inside OnSubmitRequest. It's C# code, but it should give you idea how it is done.

    public void OnSubmitRequest(DocReturnEvent e)
    {
    try
    {
    string reportType = thisXDocument.DOM.selectSingleNode("//my:reportType").text;
    string submitDestination;
    // Individual reports are e-mailed to the project manager.
    if (reportType == "Individual")
    {
    EmailAdapter emailSubmit = (EmailAdapter)thisXDocument.DataAdapters["EmailSubmit"];
    emailSubmit.Submit();
    submitDestination = thisXDocument.DOM.selectSingleNode("//my:projectManager/my:emailLink").text;
    }
    // Summary reports are submitted to SharePoint.
    else
    {
    DAVAdapter sharepointSubmit = (DAVAdapter)thisXDocument.DataAdapters["SharePointSubmit"];
    sharepointSubmit.Submit();
    submitDestination = sharepointSubmit.FolderURL;
    }
    thisXDocument.UI.Alert("The form has been successfully submitted to " + submitDestination + ".");
    e.ReturnStatus = true;
    }
    catch (System.Exception ex)
    {
    thisXDocument.UI.Alert("Could not submit " + ex.Message);
    e.ReturnStatus = false;
    }
    }
    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 04-04-2006 07:02 PM In reply to

    Re: How call two connections data after send form?

    You could also use rules for this if you like. This is described in:
    http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1956

    It's not obvious, but using rules on a button you can submit to two data connections at the same time (two separate rule actions) without having to write code.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.