About SmartObjects
SmartObjects are business entities that represent data from applications and line of business (LOB) systems. They are a middle layer between data providers, such as SQL and SharePoint, and data consumers such as forms, workflows, reports, and code.
SmartObjects allow you to create reusable objects as a standard way of querying and updating data. SmartObjects abstract the integration details to make it simpler for designers and developers to interact with data from LOB systems without needing to know or provide those details when they need to query or update data. SmartObject properties are the attributes that define the object, like columns in a spreadsheet or fields in a database table.
Applications that use SmartObjects call methods which are then executed by the K2 server based on how the SmartObject is configured to connect to the LOB system. Most SmartObjects are used to query and update information to LOB systems, and you can configure how authentication and authorization works, ensuring that only authorized users are allowed to query and update data.
It is important to keep in mind that the SmartObject layer does not replicate LOB data, but rather provides a way to abstract data from LOB systems in a more logical and business-focused manner. With SmartObjects, the LOB systems remain in control of their data and how it's queried and updated, and the SmartObjects become the mechanism through which that data is used in K2 forms, workflows, reports, and code.
A SmartObject may have associations with other SmartObjects, for example when an order contains many items, the Order SmartObject is related to the OrderItems SmartObject, just like a standard SQL relationship. In fact, when you create these associations you must specify what type of relationship it is.
When building SmartForm views, you can create multiple views based on the same SmartObject, depending on the data you need to show and how it is shown in a particular stage of a workflow. You can also use multiple SmartObjects in a single view (with one SmartObject typically being the primary SmartObject, and others used for related data), and use rules and conditions to hide, show, query, and update data from these SmartObjects.
You can create SmartObjects in the K2 Designer or K2 for SharePoint designers, and edit them from the K2 Designer category tree . You can create two types of SmartObjects:
- Simple SmartObject: Allows you to create properties and associations, and uses the K2 SmartBox service
- Advanced SmartObject: - Allows you to create properties and associations, and configure methods and composite SmartObjects (a single SmartObject that works with multiple LOBs)
See How To: Create A SmartBox SmartObject for an example of creating a SmartBox (simple) SmartObject.
SmartObjects use specific service brokers (such as SQL, Oracle, Active Directory, and SharePoint) as well as brokers that are based on a particular technology, such as REST and OData.
Use this diagram to understand how SmartObjects fit into data providers and consumers