Advanced SmartObjects
Advanced SmartObjects gives you the ability to configure the SmartObject methods by using the Service Object methods available in the environment.
When using a Service Object from the ServiceObject Explorer, it is important to note the following:
The Refresh button in the ServiceObject Explorer refreshes what is currently on the K2 Server and does not refresh the Service Instance as such. Refreshing the Service Object is an administration function and must be done using the SmartObject Service Tester Tool
K2 has created the following shortcuts:
- Drag a Service Object from the ServiceObject explorer onto the Properties or Method canvas and K2 will automatically create all the SmartObject properties, methods and mappings for you
- Drag a Service Object method onto the method canvas and K2 will automatically create the method and the bindings for you
- You can even drag a method from the ServiceObject explorer onto an existing method
Depending on the object being dragged K2 will give the minimum number of screens required to complete the configuration.
Advanced SmartObjects gives the user the ability to configure the SmartObjects using composite or service objects. SmartObject Services consist of Service Instances and Service Objects. The Service Instances represent the business objects while the Service Objects represent the properties and methods of the business objects. The purpose of using Services as a business mapping tool ensures that the business objects created represent the business view as defined in the system rather than creating duplication. Services allow business objects and methods available in the back end system to be manipulated by K2. Therefore the Services exposed within K2 are the same as from the systems where they originate from. Certain Services have limitations when integrating with SmartObjects. These limitations will affect the expected integration behavior of the Service when used in practice.
These types of SmartObjects include:
- The Out the Box SmartObjects that come with K2 such as Task Allocation, Workflow and Workflow Reports
- SmartObjects created in K2 Designer for Visual Studio
- SmartObjects created in K2 Studio
- SharePoint SmartObjects created in K2 Site Settings
- SQL SmartObjects
- CRM SmartObjects
- Service Objects
- Exchange (if applicable)
- Active Directory (if applicable)
There are two options available for creating Advanced SmartObjects properties.
Create SmartObject properties as you would for the simple SmartObject. Click Add and enter the property details. Note: If the SmartBox check box is not selected the property will be created in the SmartObject. Checking the box will ensure that the property is automatically mapped to the underlying Extended SmartObject in the SmartBox object.
Option 2 is using the Service Objects to create properties or property mappings. When the SmartObject type Advanced is selected you will notice that on the Define Properties & Methods screen the Service Object Explorer will be visible on the right hand side of the designer exposing all the existing Service Objects. Drag and drop a Service Object from the Service Object Explorer onto the properties area of the designer. The Service Object Property Mapping screen will open displaying all the selected Service Objects properties.
Select a Property and then click Assign to manually map a Service Property to a SmartObject Method Parameter , SmartObject Property, System Value or Specific Value. Selecting Create All will automatically create Service objects as SmartObject properties that do not already exist and creates a mapping for each. Selecting Auto Map will automatically create a mapping between any properties that are the same for example Id and ID. If any same named property already exists on the SmartObject, these will be used to do the mappings.
The following Map to: options are available:
- SmartObject Property - maps to an existing SmartObject property.
- SmartObject Method Parameter - maps to an existing SmartObject parameter. If no parameters exist then this option can not be selected.
- Specific Value - the user can specify a value.
- System Value - The user can map to the current SmartObject's Display name, GUID or System Name.
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
-
When using a Service Object from the ServiceObject Explorer, it is important to note the following:
The Refresh button in the ServiceObject Explorer refreshes what is currently on the K2 Server and does not refresh the Service Instance as such. Refreshing the Service Object is an administration function and must be done using the SmartObject Service Tester Tool
Actions | Description |
---|---|
Add | Opens the Add SmartObject method wizard |
Edit | Edits the property information |
Remove | Removes the method |
Remove All | Removes all the methods |
View Model | Displays the Service Object Method links to the current SmartObject |
Name | Name of the method |
Method Bindings | See Adding Advanced SmartObject Properties |
Service | See Adding Advanced SmartObject Properties |
When clicking on Add, the Add SmartObject Method wizard opens. The wizard consists of the following steps:
- Select a Service Method
- Method Details
- Default Service Method Bindings
- Service Method Bindings
- Service Object Property Mapping
- Finish
This wizard will assist you to do one or more of the following:
Option 1
Add a new method to a SmartObject - Click on Add.
Option 2
Map Service Object methods to this SmartObject method - Select a method first, then click on Add to map the service object method to the current SmartObject method. The alternative is to locate the SmartObject in the category tree and drag it onto the design canvas.
Select a Service Method to map to the SmartObject
The Method Details screen configures the Method Name, Type, and Transaction. The user can select from the drop down list, which type of Method to use. This is applicable if the Method name does not reflect the Service Object name, for example, Capture Method needs to have a Method type of Create assigned to it. The following types are available:
- Create - Creates record(s)
- Update - Saves record(s)
- Read - Uploads record(s)
- List - Lists record(s)
- Execute - Executes the method
- Delete - Deletes record(s)
Fields | Description |
---|---|
Name | The Name of the SmartObject Method |
Description | The description of the SmartObject Method |
Type | The type of Method |
Transaction | Specifies the action to be performed should the transaction fail |
If more than one Service Method exists on a view the system can be configured to ensure that the services are transactionally safe, i.e. if one of the service methods fail, the configuration will determine how to treat the rest of the transaction.
- If Continue is selected the methods will execute regardless, completing as much as it can. An error message will be displayed for the failed method.
- Selecting Stop will run the service methods and will stop processing if one method fails. The system will roll back and no execution of the methods will take place.
- Selecting Rollback will execute the methods and if one method fails all executed methods will be rolled back.
The default setting is Continue.
Certain Service Object Methods contain parameters that need to be specified in order for the SmartObject to function properly. Parameters function like a filter to ensure the correct data is returned. Parameters can be added to SmartBox SmartObjects by clicking Add in the Configure Method Parameters section. The Add Parameter screen opens.
Fields | Description |
---|---|
Parameter Name | The name of the parameter |
Parameter Description | The description of the parameter |
Parameter Type | The type of parameter, see Property types |
Parameters can be mapped to existing SmartObject Properties. If the property is a required field, the Parameter mapped to that property will also be required for the method.
These Parameters are then reflected in the Mapping Destinations of the SmartObject Method Action when clicking on configure in the Rule Designer.
They can also be used as input properties when using the SmartObject in the K2 Workflow Designer.
The Input and Return properties of the Service Object Method will be listed as shown below. If any same named method already exists on the SmartObject, the Service Object method will be added to the existing method.
Select a Property and then click Assign to manually map a Service Property to a SmartObject Method Parameter , SmartObject Property, System Value or Specific Value. Selecting Create All will automatically create new SmartObject properties for each return value. Selecting Auto Map will automatically create a mapping between any properties that are the same for example Id and ID.
Fields | What it is |
---|---|
Input Property Name | Displays the Input properties by name |
Type | Displays the SmartObject propertyType |
Required | Displays the SmartObject propertyType. The property will be displayed as required if it was created as a Key property |
Bound To | Displays the Service Object the property is linked to |
Return Property Name | Displays the Return properties name, type and binding |
Assign | Click Assign to manually map a Service Property. |
Clear | Removes the mapping for the selected property |
Clear All | Removes all the mappings |
Auto Map | Creates a mapping between any properties that are the same for example Id and ID |
Create All | Creates all the Service objects as SmartObject properties that do not already exist and creates a mapping for each |
Service Object Method | Displays the name of the selected Service Object Method. This is a mandatory field |
Map to | Maps a Service Property to a SmartObject Method Parameter , SmartObject Property, System Value or Specific Value |
SmartObject Property | Displays the properties of the source SmartObject |
The Service Method Bindings screen configures methods from Service Objects. More than one Service Object Method can be added. The Transaction setting configured on the Method Details screen will determine the action to be taken should one of the service methods fail while executing. The order in which Service Object Methods are listed on this screen, determines the order in which they will be executed. Use the Move Up or Move Down buttons to re-arrange the order in which they are listed.
Actions | Description |
---|---|
Add | Opens the Add SmartObject service method binding |
Edit | Edit the selected Method binding |
Remove | Removes the selected method binding |
Remove All | Removes all the method bindings listed |
Move Up | Reorder the bindings by moving them up or down |
Move Down | Reorder the bindings by moving them up or down |
The order of the Service binding is important as the system will execute the methods in the order displayed on this screen.
When adding Service Object Methods, and mapping properties to the source SmartObject, links are created which can be viewed by clicking on the View Model icon as shown below. The View Model changes from a grid view to a graphical view of any mappings.
Selecting the circular icon on the right of the Method window will open the SmartObject Method's wizard allowing the user to edit the method.