Reusable components provide massive time-savings to any development team that wants to lay a consistent, easy-to-maintain foundation for their application. Don’t believe me? Just ask any developer how often they use pre-existing functions, code libraries, or web services within their applications. I’ve spent a decade developing applications on K2 Software, and I’m delighted to share five tried-and-true strategies to hit the ground running with reusable applications.
We’ll jump in by quickly defining the primary components we’re going to work with inside of K2 Software, and discuss what makes them reusable.
K2 Software components
SmartObjects are connections to data, systems, or services. Typically, they are a middle layer between data providers such as SQL and SAP, and data consumers such as forms, workflows, and reports.
The data may exist within the K2 Software database, like below, or it may represent an integration point to data outside of it. SmartObjects are the lifeblood of a K2 Software application, and can even be used to call external services or code.
One of the main benefits of SmartObjects is deep reusability. Any configured connection can be reused on any View, Form, or Workflow within any application built on the K2 Software stack.
So, let’s say you’ve configured a backend integration to Salesforce or SAP. You can reuse that same connection in the next form that you create and realize the integration much faster.
Examples of reusability within SmartObjects:
- Using the same SmartObject across multiple applications without having to redefine its properties.
- Easily interact with any previously created SmartObjects from Form, Views, or Workflows.
- Call SmartObjects with code (using the SmartObject Runtime API) from any third-party application (Nintex K2 Five only)
Views are clusters of controls (and include the rules behind those controls). These Views may be bound to a SmartObject so you can enter or change data, but they can also be unbound and independent. Most views you build will be based on a primary SmartObject, but can include data from other SmartObjects.
The View below has several different controls organized within a table control. This would be placed, at a minimum, on a New Request and View Request Form.
Views are also reusable by design. As such, any View can be dropped onto any Form built on K2 Software. Simply expand the section on the left and drag it in.
Examples of reusability within Views:
- Add ‘Parameters’ to your View to alter its behavior on different Forms (ex. EditMode = ”0”). This is a popular avenue for making fields editable or read-only depending on the Form or Workflow stage.
- Call any View rule again using ‘Execute another Rule’ within the Rules.
- Use ‘Save As’ to clone any existing View.
Once Views are created, they are placed onto a Form and published, which makes them available to an end-user. The Form is the container for one or more views and may contain form-level controls and form-level rules. Overall, Forms can have many Views, depending on the complexity of your app.
We have four different Views placed within the Form below: A header, quote details, account details, and line items. Rules are used to interact across the Views and create the final Form interface.
Forms can be reused in a variety of ways, and we can be very innovative and flexible around Forms.
Examples of reusability within Forms
- Use the ‘Open a Subform’ Rule to open any previously created Form in a popup.
- Use the ‘Navigate to Another Form’ Rule to use the same ‘Submit Complete’ Form for multiple applications.
- Forms can disable specific View Rules on load, preventing any rule clashing.
- Forms can overload View Rules and insert their own unique rules into the View Rule sequence.
- Easily cascade Form Parameter values to all child Views by simply matching the Parameter names and data types.
- Form States can be created to create a duplicated version of the Form – ideal when working across more than one role that needs different functionality. Try to limit States though, as they can increase load time when overused.
- Use ‘Save As’ to clone any existing Form.
Rules control the precise logic behind the user interface. These rules are configured at either the View (child) or Form (parent) level. The different components of a rule define when something happens on the view or form (event), if it should occur (condition), and what happens (action).
In the below example, we’re setting up logical execution when the Submit button is clicked, including:
- Data validation on required fields
- Creating a new record from our SmartObject
- Kicking off a workflow
Sending the end-user to a Submit Complete screen.
Rules can also be reused – assuming that it is in the correct context (ex. a Form can call a child View Rule, or a single View Rule can be referenced more than once by a different control.)
Examples of reusability within Forms
- Cluster your Rules into methods (ex. ‘Submit Method’, ‘Read Only Method’) and run them on demand using ‘Execute another Rule’.
- Use ‘Execute another Rule’ from the Form Rules to call any child View Rule. (the View must be placed on the form).
- Create ‘Unbound’ Rules that are not tied to any event, allowing you to call them on-demand like functions.
Workflows control the flow of data, decisions, and activities assigned to each person, group, system, or service within a defined process.
- Creating a ‘Reference’ to data within a SmartObject and calling back to it within your Workflow instance.
- Calling one or more Sub-workflows (a previously created and published workflow) within your primary workflow.
- Using the Nintex K2 Workflow API to kick off a previously published Workflow from any third-party system (Nintex K2 Five or Nintex K2 Cloud).
- Use ‘Save As’ to clone any existing Workflow.
Moving forward with K2 Software reusability
Any IT organization understands the value add of application reusability. Following practical architecture methods will save weeks of effort as each application grows and changes to meet the needs of the business.
If you’re thirsty for more tips and tricks, or you’d just like to see a detailed video around this topic, feel free to check out my Nintex K2 Smartforms Tips and Tricks video.
If you are interested in learning more about K2 Software and what it can do for your organization, click here to request a free trial.