This application has two data sources that are external. The first data source (Azure SQL Service) provides a list of expense claim categories that you will use for a category drop-down list on the expense claim form. The second data source (Endpoint Web Services) has two functions: the first provides a list of currency codes that you will use for a drop-down list and the second converts the expense claim amount to US dollars. You can enter an expense claim item using another country's currency code and it is automatically converted to US dollars. This is especially helpful when entering travel expenses and eliminates the need to manually convert the amount yourself.
The first step when integrating with external systems such as SQL or web services, is to create a service instance. The service instance contains the connection configuration such as URL, server name, user name, password, and so forth. In this step, you will create a SQL Server service instance and an Endpoints Web Services service instance. You will also generate a SmartObject from the SQL Service service instance.
Creating a service instance allows K2 to discover the objects (such as the properties and methods) that the data source contains. Creating a SmartObject from the service instance allows K2 to interact with the data source through forms, workflows, and rules.
SmartObjects: The middle layer that allows interaction between a K2 object (form, view, workflow) and the target data source. For example, you have a form bound to a SQL SmartObject. When you submit the form, the SmartObject creates a new record or it updates an existing record in the SQL table. The SmartObject connects K2 to the system via the service layer.
Field | Value | Notes | |
---|---|---|---|
Service Instance | |||
A. | Display Name | K2 Tutorial SQL Database | |
B. | Description | Service instance for the sample database used for K2 tutorials. | |
C. | Service Type | SQL Server Service | You will connect to a SQL database as the provider for this service instance. This is the connector used to connect to the target system. These connectors are also known as service types or service brokers and are usually technology-specific. |
Service Authentication | |||
D. | Authentication Mode | Static | You will provide a static username and password to connect to the sample SQL database. |
E. | User Name | K2LearningUser | |
F. | Password | K2LearningPass | |
Extra | (leave blank) | ||
Service Keys | |||
G. | On Different SQL Server | true | The database exists on a physically different SQL server than your K2 system. |
H. | Command Timeout | 90 | You want to extend the command timeout from the default to cater for high load. |
I. | Database | K2Learning | This is the name of the target database on the target SQL server. |
J. | Server | uh8ydarb4m.database.windows.net | This is the name of the SQL server you want to connect to. |
K. | Use Native SQL Execution | false | You do not want K2 to use native SQL commands for this target database. It exists on a separate server and the K2 service account does not have enough permissions on the target system to perform DDL operations. |
SmartObjects | |||
L. | Generate SmartObjects for this Service Instance | UNCHECKED | You will create the SmartObject after this step. |
Field | Value | Notes | |
---|---|---|---|
Service Instance | |||
A. | Display Name | K2 Tutorial SQL Database | |
B. | Description | Service instance for the sample database used for K2 tutorials. | |
C. | Service Type | SQL Server Service | You are connecting to a SQL database as the provider for this service instance. Connectors are also known as service types or service brokers. They are technology specific. |
Service Authentication | |||
D. | Authentication Mode | Static | You will provide a static username and password to connect to the sample SQL database. |
E. | User Name | K2LearningUser | |
F. | Password | K2LearningPass | |
Extra | (leave blank) | ||
Service Keys | |||
G. | On Different SQL Server | true | The database exists on a physically different SQL server than your K2 system. |
H. | Command Timeout | 90 | You want to extend the command timeout from the default to cater for high load. |
I. | Database | K2Learning | This is the name of the target database on the target SQL server. |
J. | Server | uh8ydarb4m.database.windows.net | This is the name of the SQL server you want to connect to. |
K. | Use Native SQL execution | false | You do not want K2 to use native SQL commands for this target database since it exists on a separate server and the K2 service account does not have permissions on the target system to perform DDL operations. |
SmartObjects | |||
L. | Generate SmartObjects for this Service Instance | UNCHECKED | You will create the SmartObject after this step. |
The Execute SmartObject Method screen opens. Here, you can apply filters before executing the method. In some cases, such as read methods, you must provide input parameters before executing the method. For this test, you just want to confirm the connection, so you don't need any filters.
Field | Value | Notes | |
---|---|---|---|
Service Instance | |||
A. | Display Name | K2 Tutorial Currency Web Service | |
B. | Description | Service instance for the sample currency web service used for K2 tutorials. | |
C. | Service Type | Endpoints WebService | |
Service Authentication | |||
D. | Authentication Mode | ServiceAccount | You will use the credentials of the K2 service account to connect to the target web service. When using the service account authentication mode, the service account must have the necessary permissions to interact with the data source. Be aware of this when registering a new service instance in your own environment. |
Service Keys There is only one service key value to set in this step (WebService URL). | |||
E. | WebService URL | http://k2learning.azurewebsites.net/ExchangeRates.asmx | This is the URL of the target web service you will connect to. |
F. | Generate SmartObjects for this Service Instance | UNCHECKED | You will manually create a SmartObject in a later step. |
Field | Value | Notes | |
---|---|---|---|
Service Instance | |||
A. | Display Name | K2 Tutorial Currency Web Service | |
B. | Description | Service instance for the sample currency web service used for K2 tutorials. | |
C. | Service Type | Endpoints WebService | |
Service Authentication | |||
D. | Authentication Mode | ServiceAccount | You will use the credentials of the K2 service account to connect to the target web service. When using the service account authentication mode, the service account must have the necessary permissions to interact with the data source. Be aware of this when registering a new service instance in your own environment. |
Service Keys There is only one service key value to set in this step (WebService URL). | |||
E. | WebService URL | http://k2learning.azurewebsites.net/ExchangeRates.asmx | This is the URL of the target web service you will connect to. |
F. | Generate SmartObjects for this Service Instance | UNCHECKED | You will manually create a SmartObject in a later step. |
In this step, you created two service instances for external data sources. The first data source is an Azure SQL database, while the second data source is a web service. The SQL data source provides the drop-down list values for expense categories. The web service provides values for currency conversion and currency listings. You generated a SmartObject from the SQL Server service instance, selecting the single expense category table. For the currency SmartObject, you will create a new SmartObject from scratch using K2 Designer. In the next step, you generate application elements from the Expense Claim list. This creates the base artifacts for the expense claim application: views, forms, and reports.