Audience
  • Developers
  • Form Designers
Required Knowledge
  • SmartObjects
  • Views
  • Controls
  • Rules and Rule Designer

Introduction

The latest How To topics are available in the K2 Five User Guide or the K2 Cloud User Guide’s How to section.

Custom control methods can now be executed in Runtime. Execute Control Method Actions have been added to the Control Interaction section of the Rule Designer to provide the ability to execute custom control methods in Runtime. The Save As PDF control and Content control also contains methods that can be used with these Actions.

Properties can be set before the method of the control executes, and mapped after the method has executed. This allows a combination of the controls properties and/or the method parameters to be used in the control’s method.

Implementation Details

The following execute control method Actions are available in the Rule Designer:

View level:

Image

Form level:

Image

By selecting the Execute a control's method Action for example, the custom control can be selected and the methods available for that control will be listed as shown below. 

Image

By clicking on configure next to the method, the properties of the control can be set prior to method execution and retrieved after execution. In the example below, the values of text 1 and text 2 will be concatenated in runtime. In addition, the value of one control's property can be transferred to another control's property if the properties are the same.

Image

Next, the Output Mappings can be configured if the control has a return method. Click Next or click on the Output Mappings step at the top. Map the field to the control where the result should be displayed.

Image

 

Example Scenario

In the scenario below we will be using the Save As PDF control to save a Form with Tabs as a PDF document. Follow the steps below to set up the scenario:

  1. Create a custom PDF SmartObject with the following properties. This SmartObject will be used as the data source where the PDF will be saved:
    1. ID – Autonumber
    2. PDFFile – File
    3. Notes - Text
    Image
  2. Create a List View of the PDF SmartObject, called PDF List.
  3. We created a Form with two Tabs called Customer and Region. The Customer Tab contains the Customer Item View and the Customer List View. The Region Tab contains the Region List View.
    Image
  4. Add a Button control to the Form and call it Save PDF.
  5. Add the Save as PDF control to the Form.
  6. Click on the Save as PDF control, click on the ellipsis next to SmartObject in the Data Source section and select the custom PDF SmartObject created previously.
  7. Configure the Page Size and Page Orientation in the Properties pane.
    Image
  8. Go to the Rules to set up the following Rule. The Save as PDF control contains a method called Save PDF. Select the method.
    Event: When a control on the Form raises an event.
    Action: Execute a control's method
    Image
  9. Click Finish to save the Rule and Finish to save the Form.
  10. Run the Form.
  11. Capture some data and click on the Save PDF button.
    Image
  12. Run the PDF List View.
  13. The PDF item is listed. Click on the link to open the item.
    Image
  14. The PDF document is opened and the Form is displayed. Each tab is listed on its own page.
    Image