Simple SmartObjects
Simple SmartObjects allows you to create SmartObject properties and their associations. By default K2 will create the five standard methods available on all SmartObjects.
The SmartObject property screen displays all the properties and their configuration settings such as, Type and Key. The “ID” auto number property is added by default to all new SmartObjects. This property can be edited and changed for example to EmpID or deleted. A SmartObject requires at least one Key property.
To add a new property, click on Add. The Add SmartObject Properties screen opens. The details of the property can be captured here.
Action | Description |
---|---|
Add | Opens an entry line where the property can be added |
Edit | Edits the property information |
Remove | Removes the property |
Remove All | Removes all the 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 SmartObject property |
Description | The description of the SmartObject property |
Type | Indicates the type of the property, see Property Types below |
Key | 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. A SmartObject requires at least one Key property |
Required | Creates the property as a required field when creating a View or a Form from the SmartObject. This is purely for View and Form validation |
Unique | Creates the record as unique in the database |
Type | What it is |
---|---|
Autonumber | When a new listing in the SmartObject is created the listing will contain an index which is automatically generated |
AutoGUID | The AutoGUID is similar to the Autonumber, it takes on the role of an identity type field where a GUID will be auto generated when a record is created |
Date | The properties can be set to display the data in a date format. See the Date/Time Use Cases section. |
Date Time | The properties can be set to display the data in a date and time format. See the Date/Time Use Cases section. |
Decimal | Decimal numbers can be entered in the SmartObject property at runtime |
File | Stores a file of any format |
GUID | Global Unique Identifier |
Hyperlink | Stores the property data as a hyperlink |
Image | Stores an image of supported types |
Memo | Large String |
Multivalue | Multivalue data types are used to store multiple values in one SmartObject property. When using Service Objects that have multi value properties, such as the AD service object, the multiple values are translated from the XML schema provided that the correct schema format is adhered to. If the format differs the data type will not work and the data will not we returned as expected. An example of the expected schema for K2 smartforms would be: <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 supported with a checkboxlist control in Views. This will update and read the values from the multivalue property.The values shown in the checboxlist can be either static values or SmartObject list results. |
Number | Only numerical values can be input at runtime |
Text | Stores ANSI standard text characters |
Time | The properties can be set to display the data in a time format. See the Date/Time Use Cases section. |
Yes/No | Boolean type property |
Use cases of Date, Datetime, Time, Timezone data types:
- Datetime - Should be used to specify a utc time that will show in different locations relative to the user's timezone.
- Datetime with timezone - Should be used to specify a utc time that will not vary depending on the user's timezone.
- Date - Should be used for a timezone invariant date (no time).
- Time - Should be used for a timezone invariant time (no date).
Property Types or better known as data types are automatically validated upon executing the CREATE or SAVE method on a SmartObject.
For example, if a user tries 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 will be surfaced, stating that validation has failed.
The Methods tab is only available when creating an Advanced SmartObject
The Methods tab is not visible when creating a Simple 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. Should there be a need to choose multiple SmartObject services, or to add/delete SmartObject methods, it is advised to create an Advanced SmartObject or edit the Simple SmartObject and change the type to Advanced SmartObject.