How do you call out a data connection in form code? - InfoPath Dev
in

InfoPath Dev

How do you call out a data connection in form code?

Last post 12-13-2008 05:15 AM by Shiva. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-12-2008 08:06 AM

    How do you call out a data connection in form code?

    I guess the subject explains it all, but I want to give some background.  I have multiple secondary data connections, all set up to submit via e-mail.  I know I have to set my buttons up to use Rules and Custom Code because there's multiple buttons.  That being said, I've tried

    function CTRL75_7::OnClick(eventObj)

    {

    DataConnections["Main Connection"].Execute();

    }

    This however causes an error, so obviously it's not right.  What'd I'd really like to do is find out how to automatically start a workflow with a single submit button, I feel that will work better as opposed to the makeshift workflow I have now, but even with that, I'll still need to know how to call out a data connection in the form code.

  • 12-13-2008 05:15 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: How do you call out a data connection in form code?

    Hello,

    Here is the code to get the secondary data connections,

    DataConnection aa = this.DataConnections["Data connection name"].Execute();

    //Get the navigator for above data source

    XPathNavigator dataSource = this.DataSources["Data connection name"].CreateNavigator();

    //Get the node

    XmlNode selectedNode = dataSource.SelectSingleNode("XPath of the field");

    To implementation of workflow, you have to add the code while submitting the form you have to change the form status ID and status name. These two fields are related to workflow. Depends on these field values you have to change next status.

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