​​How to execute and use the execution results of a Web Connector control through a Button control?

Last Update: June 21, 2018

Suppose you have a Web Connector control on a form that call a web service to POST information to an external database and you want to execute this through a Button control and to get the execution results back in order to be used in the form.
Here are the steps on how to do that.

  1. Open the form in design mode.
  2. Add a Web Connector control to the form design workspace and change its ID property to "WebConnector1".
  3. Configure the WebConnector1 control by clicking on the "Control Settings selector" under the control properties.
  4. Add a Button control to the form design workspace and change its ID property to "Button1".
  5. Select Button1 control.
  6. In the Rules pane, click on the Add icon to add a new rule, the Rule Manager dialog will open.
    How to auto-shifting Panel control in a form2.jpg
  7. Add a new rule as follows:
    A. Change the Rule Name as desired.
    B. Change the Rule Type to Action.
    C. Keep the Event Type onChange.
    D. In the Action section, type the following script:
        function docallback(){
     //generateWebConnectorData() //use this function to get a field or more than one field from a web service    fields  values and assign them to a specific form controls.
       //Or getWebConnectorData() // use this function to get a web service field value from Web Connector data.
        }

       executeWebQuery(webConnector1,docallback)

    E. Click on the Save button to save the rule.
    Note: You can use Assistance Panel to help you adding functions and related parameters, form variables and form controls to Conditions and/or Actions sections.
  8. Test the form by publishing it and adding a new item to the list.