How to submit via more than one data connection AND run custom code? - InfoPath Dev
in

InfoPath Dev

How to submit via more than one data connection AND run custom code?

Last post 08-05-2009 01:06 PM by lenovo27. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-21-2009 11:23 AM

    How to submit via more than one data connection AND run custom code?

    Hello, I've got two data connections set up in my form.  The first submits to an Access DB, and the second e-mails the form.  I'd like to submit to both of these connections; however, I also have some code that needs to run on submit.  Seems like that precludes using rules for the submit.

    Previously, I had only the main connection (no e-mail data connection) set up, and I used XDocument.Submit at the end of my code to perform the submit.  If I do that now, with the two data connections, it only submits via the main connection.  I could use XDocument.UI.ShowMailItem in my code, but I need control over the name of the attachment.  I can get that from the e-mail data connection but not from the ShowMailItem method, if I'm not mistaken.

    Is there a way to get at what I'm trying to do?  Web services aren't an option for me.

    -- Kelley
  • 04-22-2009 03:31 PM In reply to

    Re: How to submit via more than one data connection AND run custom code?

    Here is some sample jscript from MSDN that submits with an email adapter:

    var objEmailAdapter;
    objEmailAdapter = XDocument.DataAdapters("Email Submit");
    objEmailAdapter.To = "[email protected]";
    objEmailAdapter.Subject = "Status Report";
    objEmailAdapter.Submit();

    You can replace "Email Submit" with the name of your email submit connection. This sample also sets the To and Subject, but if you've set that up in your email submit, you can skip those lines. More info here on MSDN.

    Hilary Stoupa

  • 08-05-2009 01:06 PM In reply to

    Re: How to submit via more than one data connection AND run custom code?

    No, I don't believe it precludes you from using rules to submit to a DB and email, and running code. In Tools, Submit Options, rather than selecting a data connection for the submit from the drop down menu, click the radio button that says perform custom actions using rules then click teh rules button to the right of it. Create a rule to submit via email and another rule to submit to your DB in either order. Using VSTA you should still be able to write code in your application to execute the code you need to run onclick of the submit button. 

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