Advanced SmartObjects: Properties
SmartObject properties define the data 'fields' of the SmartObject, similar to columns in a database or spreadsheet. SmartObject properties are most often associated with data required by, or returned by, SmartObject methods. This is known as binding: you 'map' or 'bind' a field returned by a method, to a property of that SmartObject. When editing a SmartObject in advanced mode, you can edit the properties for that SmartObject in the Properties tab, as shown below:
Field | Description |
---|---|
Name | A descriptive name for this SmartObject property. |
Type | The data type of the property. See SmartBox properties for a listing of the available data types. |
Key | Whether this property is used as a key/unique value, typically used for ID fields. |
SmartBox | Whether this property stores its data in K2 SmartBox. |
Required | Whether this property must have a value, or if it can be null. |
Unique | Whether this property must be a unique value, such as a GUID. |
There are several ways to create advanced SmartObject properties:
- Manually: Add properties to the SmartObject and map them later when editing the SmartObject's methods. To manually add properties, create SmartObject properties as you would for a standard SmartObject. Click Add and enter the property details. You then define how the SmartObject property maps to service object properties using the methods configuration wizard.
- Automatically: Have the designer automatically create properties for you while you are defining the SmartObject's methods. To automatically create SmartObject properties, add a method from an existing SmartObject or service object and select the Create All option to create all the properties.
- During Service Object configuration: Create properties using the service object methods configuration screens. Create properties individually by clicking the Create button on the Map ServiceObject Property dialog, or have K2 automatically create all properties by clicking the Create All button. Selecting Create All automatically creates SmartObject properties for the service object properties that do not already exist and automatically creates a mapping for each property.
Creating Properties in the Inputs & Outputs screenWhen mapping Service Object properties, the following Map to options are available:
- SmartObject property: Map the service object property to an existing SmartObject property.
- SmartObject method parameter: Map the service object property to an existing method parameter. (If no method parameters exist, this option can not be selected.)
- Specific value: Specify a static value for the service object property. This is mostly used if the method should always use the same, static input value whenever the method is executed.
- System value: Map the service object property to the SmartObject definition or executing user's identity.
- This SmartObject's display name
- This SmartObject's GUID
- This SmartObject's system name
- Current User's Identity (FQN)
- Current User's E-mail
- Current User's Account Name
- Current User's Display Name
- Current User's Manager's Account Name
- Current Date
- Current Time
- Current Date and Time
The following System value options are available:
Fields Description and notes This SmartObject's display name The display name of the SmartObject that executes the service object. Mostly used if the service object method needs to know which SmartObject it was called by. This SmartObject's GUID The GUID (Global Unique Identifier) of the SmartObject that executes the service object. Mostly used if the service object method needs to know which SmartObject it was called by This SmartObject's system name The system name of the SmartObject that executes the service object. Mostly used if the service object method needs to know which SmartObject it was called by. Identity The user identity that executes the SmartObject. This value is most often used if you need to know which user executed the SmartObject method.
This value is not based on the Authentication Mode configured on the service instance of the service object method, but rather the user executing the SmartObject method. For example, if you configured the service instance authentication with Static credentials using username K2Admin, and Denallix\Bob executes the SmartObject, the Identity fields will be based on K2:Denallix\Bob. You can use this option with any authentication mode on the service instance, including Static and ServiceAccount, and pass in the executing user's identity for auditing or security purposes.
The following user properties are available:
Field Example Current Users Identity FQN (Fully Qualified Name) K2:Denallix\Bob Current User's E-mail bob@denallix.com Current User's Account Name Denallix\Bob Current User's Display Name Bob Magio Current User's Manager's Account Name Denallix\Codi For more information about using this field, see Sending Identity Information to a Line of Business System.
Date and Time These properties use the current date/time of the server. Map these properties to DateTime, Date/Time type service object properties respectively to avoid any regional settings conversion problems.
If these properties are mapped to string type service object properties, they are passed in as UTC time using the ISO8601 standard format (yyyy-MM-dd HH:mm:ss.fffZ).These properties are very useful for auditing purposes to ensure that all date and time audit information uses a server value that is administered and secured centrally.
The following date and time properties can be used:
Field Example Current Date and Time 2019-12-20 09:45:00 Current Date 2019-12-20 Current Time 09:45:00
See the topic advanced SmartObjects methods for more information about mapping properties to service object properties.
Considerations
- Take care when editing existing SmartObjects, especially if renaming or deleting existing properties or methods. If you rename, change or delete a property or method, you could break an application that requires that property or method.