SmartBox SmartObjects
SmartObjects allow you to create data objects by specifying properties and associations using the K2 SmartBox service. You automatically get the five standard methods available on all SmartObjects you create this way.
The SmartBox Service service type is used for SmartBox-based SmartObjects. SmartBox is a K2-managed SQL schema in the K2 database and is used for storing SmartObject data when there is no existing line-of-business system to store the data. SmartObjects you create using the K2 Designer typically use the SmartBox provider unless you change the SmartObject to use data from another service type. See SmartBox Service for more information.
The Properties tab displays all the properties and their configuration settings such as Type and Key. The ID autonumber property is added by default to all new SmartObjects. You can edit this property and change it, for example to EmpID, or delete it. A SmartObject requires at least one Key property.
To add a new property, click Add. The Add Properties page opens. You can capture the details of the property here and select a property type.
Action | Description |
---|---|
Add | Creates a line where you can add the property name |
Edit | Edits the property information |
Remove | Removes the property |
Remove All | Removes all properties |
Move Up | Changes the position of the property selected with the property above it |
Move Down | Changes the position of the property selected with the property below it |
Name | The name of the property |
Description | The description of the property |
Type | The type of the property |
Key | The Key property identifies the property as unique, which ensures that the value of the property is always unique and no two records can contain the same data for this property. A SmartObject requires at least one Key property |
Required | Creates a required property when new records are added to the SmartObject, for example from a view or a form |
Unique | SQL specification that sets a requirement for this field to be unique |
The following property types are available when you create a SmartObject property:
Type | What it is |
---|---|
AutoGUID | Similar to Autonumber, AutoGUID is an identity type where a GUID is auto-generated when a record is created |
Autonumber | When a new record is created in the SmartObject, an index number is automatically generated |
Date | Allows you to set a property to display data in a date format |
Date Time | Allows you to set a property to display data in a date and time format |
Decimal | Allows you to enter decimal numbers in the SmartObject property |
File | Stores a file of supported types |
GUID | Global Unique Identifier |
Hyperlink | Stores the property data as a hyperlink |
Image | Stores an image of supported types |
Memo | Large String |
Multivalue | Use multivalue data types to store multiple values in one SmartObject property. When you use service objects that have multivalue properties, such as the Active Directory service object, the values are translated to the XML schema provided below . If the format cannot be translated, the data type is not stored. An example of the expected schema is: <collection> <object> <fields> <field> <value>2</value> </field> <field> <value>4</value> </field> <field> <value>6</value> </field> </fields> </object> </collection> The multivalue data type is typically used with a Check Box List control in views. This reads and updates the values from the multivalue property. The values shown in the Check Box List can be either static values or SmartObject list results. |
Number | Allows you to input numerical values |
Text | Stores ANSI standard text characters |
Time | Allows you to set a property to display the data in a time format. |
Yes/No | Boolean type property |
Use the information below to determine where and when to use the following data types:
- DateTime - Allows you to specify a Coordinated Universal Time (UTC) that shows the time in the local timezone.
- DateTime (with timezone) - Allows you to use a UTC time that does not vary based on the local timezone.
- Date - You can use this for a timezone-invariant date (no time).
- Time - You can use this for a timezone-invariant time (no date).
You can configure settings that further define the SmartObject properties. The types of settings depend on the property type you edit. This means that not all settings are available on all property types. Follow the steps below to configure the property settings.
Some of the additional property settings such as Maximum Size, Time Precision, and Constant Size only apply to SmartBox SmartObjects. Other line of business systems might not support the property settings as described in the table below. When a SmartObject is a SmartBox object, several property settings may only be changed when there is no data in the SmartBox SmartObject. If there is data you may be blocked when trying to save the changes. If that is the case, you must export data from the SmartObject, delete that data, update the SmartObject, and then import the data again.
- From the K2 Designer, select the SmartObject and click Edit.
- Select the property and click Edit.
- The Edit Property page shows.
- Click OK to save changes made to the properties.
The following table describes the available property settings:
When you work with Advanced SmartObjects, make sure to check the SmartBox check box to enable the additional settings.
Property types or better known as data types are automatically validated upon executing the CREATE or SAVE method on a SmartObject. For example, if you try to CREATE a new record for a SmartObject property called Mobile with a data type of type [Number], but with a value that is of type [Text], a server side message displays stating that validation has failed.
The Methods tab only displays when creating an Advanced SmartObject.
The Methods tab is not visible when creating a standard SmartObject as default methods are automatically created for this type of SmartObject. The methods created by default are:
- Create - Creates records
- Save - Saves records
- Load - Uploads records
- Delete - Deletes records
- Get List - Lists records
These methods are available in the K2 Object Browser under Environment > SmartObject Server for use in K2 workflows. If you want to choose multiple SmartObject services, or to add/delete SmartObject methods, you must create an Advanced SmartObject or edit the SmartObject and change the type to Advanced SmartObject.