How To: Add a Service Method Link in an Advanced SmartObject

When you create a composite SmartObject that uses two List methods from different service objects, you need to tell the system how it should 'join' the data from the two data sources. Think of this as similar to a SQL 'join' statement: if you select data from two tables, there must be some common property used to 'link' records from one table to records in another table. Service Method links is how you define this 'join' statement when building a SmartObject.

This topic explains how to use a Service Method link. You create an advanced SmartObject that uses the email field of two Service Object List methods to join data from two different data sources. In this example, you use a matching values in both objects (inner join) service method link to perform the join, which will only return records in both systems when the email address property matches.

The service method link screen

Scenario

You have two employee SmartObjects, Employee List which contains employee details (including an email address), and AD User which contains user details (including an email address). You create an advanced SmartObject with a service method link that uses the email address field in each of the two service object list methods to 'join' the data from the two systems.

Steps

For this scenario, you create an advanced SmartObject, adding the Get List method of the Employee List SmartObject and configuring the AD User GetUser service object list method to link the Email property using a matching values in both objects (inner join) service method link type.

Setup Steps

The following steps set up the scenario. If you want to skip the setup steps and view the topic step, go to Create a new Global List SmartObject.

  1. Create your Employee List SmartObject.
    1. In the Designer create a new SmartObject using the following image as a guide.
    2. Add the following properties, as shown in the image below, then click Finish.
    3. Add content to your SmartObject, using email addresses that match those in your AD Users list.

Create an advanced SmartObject with a service method link

Create and configure an advanced SmartObject, adding the Get List method of your Employees List Service Object, and binding it with the GetUser method of the AD User Service Object, using the email property.

  1. Create a new Global List SmartObject.
    1. In the Designer create a new SmartObject and specify Global List as the name.
    2. Specify a Description and Category. In this example we use Denallix as the category.
    3. Select the Advanced SmartObject option.
    4. Click Create.
  2. Add the first Service Object list method. In this case, add the Get List method from your Employee List SmartObject.
    1. Select the Methods tab and click Add.
    2. Navigate to and select the SmartBox Service > Employee List > Get List method.
    3. Click Next.
    4. You don't need to edit the Details, so click Next again.
    5. For your Inputs & Outputs click Create All to create the SmartObject properties and bindings.
    6. Click Next.
  3. Add the second list method. In the ServiceObject Methods screen add the AD User > GetUsers method, and then set up a Service Method link to join the SmartBox Service.Employee List.Get List with the Active Directory Service2.Ad User.GetUsers method, using the email property to define a matching values from both objects join.
    1. In the Service Object Methods screen click Add.
    2. Navigate to and select the Active Directory Service2 > AD User > GetUsers method.
    3. Click OK.
    4. Click Create All to create the properties and bindings of the GetUsers method.
    5. Click OK.
    6. Click Next.
    7. Now you will set up the Service Method link that will determine the 'join' operation. Click Add to create a Service Method Link.
    8. Your screen should look similar to the following image. Notice that the system uses the Matching values in both objects (Inner Join) option by default. You can change this if you wanted to do a left or right join instead.
    9. Select the Email property and click Assign. (You are selecting the common 'email' property from the first service object here.)
    10. From the Property Name drop down select Email. (You are selecting the common 'email' property from the second service object here). This property 'joins' the two SmartObject methods together using the email address.
    11. Click OK. Your Add Service Method Link screen should look similar to the following image:
    12. Click OK.
    13. Click Finish to complete your SmartObject
  4. Test your SmartObject by creating a View.
    1. On the Global List SmartObject page click Design a new View.
    2. Name this view Global List View, specify a Description and Category, and then select List View as the View Type.

    3. Select Create Labels and Controls.

    4. Select some properties from each data source to display on the view. .
    5. Click OK
    6. Click Finish to complete the view.
    7. Click Run to load the view.
    8. You should see the list populate with a listing of employee data, retrieved from both the SmartBox database and Active Directory.
Review

You created an advanced SmartObject, adding the Get List method of the Employee List service object and configuring the AD User GetUser service object list method to link using the Email property using a matching values in both objects (inner join) service method link type. This returns a list of records from both systems where the email property is the same between the two systems.