This exercise will introduce you to K2 SmartObjects and how you can define SmartObjects that interact with other systems such as Active Directory. Remember that SmartObjects are essentially a “middle layer” that allows Consumers of Data (such as forms and workflows) to interact with Providers of Data (such as SQL Databases, Active Directory or SharePoint, among others).
In Step 1 of this part we will create the Categories ("Folders") used to store the elements of our application, and in Step 2 we will create an advanced SmartObject using K2 Designer.
In this part, you will learn:
The first step in our application is to create the categories that will house our Forms, Views, SmartObjects and Workflows. You can think of categories as “folders”. While it is not necessary to group elements into folders like we do here, it does help to keep the similar elements together, especially for larger applications that may contain several SmartObjects, Views, Forms and Workflows.
In this step, we will create a SmartObject that connects to Active Directory. K2 has predefined Service Instances for Active Directory, which we will leverage for our application. We will map two methods. The first, GetUsers, will be used in a List View to output a list of Active Directory (AD) accounts. The second, GetUserDetails, will be used in an Item View where we will output and subsequently update the account details for one specific user.
Allowing a SmartObject to be used in workflows exposes the SmartObject's methods in the Workflow Designer. We are creating an Advanced SmartObject because the data for this SmartObject comes from another system, in this case Active Directory.
The first method we are going to define will be the GetUsers method, which will output all of the AD users on a List View that we will create in a later step.
Behind the scenes, K2 is binding the various Active Directory User fields (such as Name, Email, Manager, etc.) to the new AD User SmartObject properties. This essentially "maps" or "links" the fields from Active Directory to the properties for our new SmartObject.
The second method we are going to define will be the GetUserDetails method, which will output the account details for a single Active Directory record. We will use this method in a later step for updating a single AD account.
For the GetUserDetails method, there is only one property that can be used to retrieve the account details. This property is the UserName. Notice in the image below, it is shown as the only Input Property for this method. In other words, we will retrieve the AD account details using the UserName property. We want to be able to retrieve all of the fields that we can, so we will auto-map all of the GetUserDetails properties as Return Properties. In the next step, we are going to assign the UserName property to the SmartObject property as we did for the GetUsers method. This will bind the SmartObject to a specific Active Directory account. (Remember, we want to retrieve details for a specific user here, so we will need to pass in the name of the user whose details we want to retrieve)
Your SmartObject Designer screen should now look like the image below.
In Step 2 we created the AD User SmartObject containing two methods: AD GetUser (retrieves a list of users) and AD GetUser Detail (retrieves details for a specific user). While creating this SmartObject, we took advantage of the Service Instances that K2 provides as standard for the Active Directory Service Type.
Video | Links | Learn | Support |
No videos found for this article K2 on YouTube
No Additional links found for this article
No self-learning content for this article Try some scenarios...
No relevant support links available for this article
|