Introduction

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

This Knowledge Base article describes how to use a SmartObject Method Parameter that is generated from an Advanced SmartObject created using a Service Object Method in K2 smartforms.   

Implementation

SmartObject Method Parameters surface in Advanced SmartObjects. In this example we are using the ADService2 GetUserDetails Service Object Method to create an Advanced SmartObject that contains a SmartObject Method Parameter. The parameter “Username” will be required to execute the “GetUserDetails” method in runtime.

Follow the steps below to implement the scenario as described above:

  1. Create the Get User Details SmartObject and select Advanced SmartObject as shown below. Click Next.
    Image
  2. Expand the Active Directory Service2 ServiceObject instances in the ServiceObject Explorer on the left and expand AD User. Drag the GetUserDetails method onto the canvas as shown below:
    Image
  3. The Method details screen will open. Click Next.
    Image
  4. Note the parameter “UserName” that is added as the Input property name. Click Create All to create ServiceObject method bindings for the SmartObject. Click Next and Finish.
    Image
  5. Select the Methods tab. Note the GetUserDetails method that was added. Click Finish to create the SmartObject.
    Image
  6. Generate an Item View using the Generate a View function on the Finish screen of the SmartObject Designer.
    Image
  7. Edit the View and go to the Rules step to see how the parameter has been used in the rule. Edit the Rule When GetUserDetails Button is Clicked. The GetUserDetails method will execute when the GetUserDetails Button is clicked. This Rule is automatically added when generating the View. Click Finish to close the Rule Wizard and Finish to close the View. 
    Image
  8. Now Run the View and click on the Get User Details Button at the bottom. A dialog box is displayed listing the Text Box required to be populated. This is the parameter that is required to execute the GetUserDetails method of the SmartObject created.
    Image
  9. Type a valid name in the User Name Text Box at the top and click the Get User Details Button again. The View is populated with the data retrieved using the SmartObject method.
    Image