Designers > K2 Studio > Access > Understanding SmartObjects and Service Objects > K2 SmartObject Principles | Send feedback |
In K2 blackpearl, an Object or SmartObject is a concrete realization of a class, representing a person, business unit or data silo that consists of data and the operations associated with that data. As an object, it can be manipulated as a single object or in conjunction or unison with other objects to perform a task or tasks.
The K2 SmartObject Properties are the attributes that define the object. They are things like First Name, Last Name, Social Security Number, department and so on. Properties are created manually when a user creates the SmartObject or they are retrieved via a service and the SmartObject is created to expose / surface the properties from the back end system.
Fig. 1. Example of a SmartObject
The property itself has the following attributes that define it:
SmartObject Properties | What it is |
---|---|
Name | The name given to the property e.g. First Name. This name uniquely identifies the property within the object |
Description | The description is for information purposes only and describes the property. Descriptions can be useful when discriminating between properties that have similar names or similar uses in the object. |
Type | This refers to Data type or variable type |
The Key property identifies the field / property as unique which ensures that the contents of the property will always be unique and no two fields will contain the same data. |
The number of properties allowed for SQL based SmartObjects are limited by the Microsoft SQL Server's limitation. |
SmartObject methods are categorized into two types:
Fig. 2. SmartObject Methods
The methods available are default methods created and made available at design time. The default methods can be removed from the K2 SmartObject and new ones created. A K2 SmartObject must have at least one method. |
SmartObject Methods | What it is |
---|---|
Create | Create record instance in the K2 SmartObject |
Save | Saves the record instance in the K2 SmartObject |
Delete | Deletes the record instance from the K2 SmartObject |
Load | Loads records from the K2 SmartObject |
Get List | Retrieves data from the K2 SmartObject/s and lists the data in a list control on a form. The GetList command would normally retrieve records from the server |
SmartObjects are grouped in three folders namely: Root, Workflow and Workflow Reports:
Fig. 3. K2 Object Browser
SmartObject Display Groupings | What it is |
---|---|
Root/SmartObject Server | Displays the SmartObjects created in K2 Designer for Visual Studio |
Workflow | Displays the Workflow process that has been created as a SmartObject. The Workflow SmartObject works with the runtime of the process and only surfaces client event objects and process objects and contains methods such as Start Process and Approve Order |
Workflow Report | Displays the Workflow process that has been created as a SmartObject for reporting purposes. The Workflow reporting SmartObject works with logging data and are created for Process Instances, Activity Instances and Event Instances and only have list methods such as Get Process Instance |