Creating a K2 Package
We recommend that you review the Version Considerations before creating packages.
Step 1: Open K2 Package and Deployment
Open the email you received on Packaging and Deploying apps and follow those instructions to connect. Once connected, log in using your Azure Active Directory details. You must be a member of the Package and Deployment role in order to log in.
Step 2: Create
Click the Create New Package button.
On the Create Package dialog, specify a name for the package in the Package Name text box. Enter a description of the package and click the Browse button to choose the location to save it.
- When using SharePoint solutions, try to keep solutions as simple as possible. Avoid using the same artifacts between two different SharePoint solutions as this can create potential mismatches.
- When creating packages containing SharePoint artifacts, if you have moved forms, views or workflows created using the K2 for SharePoint application, or renamed categories, K2 may not be able to locate and package these items.
Step 3: Add Items
- Click Next to navigate to the Add Items page.
- Click Add Item. Package and Deployment connects to the K2 server and compiles a list of artifacts that can be packaged. Checked out artifacts are marked with a yellow exclamation mark and a message stating which version of the artifact will be used in the package.
- Select the K2 artifacts (SmartObjects, views, forms, workflows, style profiles, and reports) to include in the package. The Type column shows what the artifact is, and if you select an artifact you can see its properties in the Properties and Data pane on the right.
Artifacts may be packaged as full objects or as referenced items. Referenced items are essentially "pointers" or "placeholders" for items that already exist in the target environment. Select the check box at the bottom of the Add Items dialog to automatically include all dependent items as Included Items (full objects) or as Referenced Items. When you select to automatically include dependent items as Referenced Items, note that the dependent workflow (process) is not included as a referenced item. If you want to include the dependent workflow (process) as a referenced item, you must manually right-click the workflow (process) and select Package By Reference. If you select Package by Reference, ensure the structure of the artifacts in your source and target environments match to prevent unnecessary mismatches.
Disable the check box and configure each artifact manually by right-clicking the artifact and selecting how you want to package it.By default SmartObject data is not included, so that SmartBox SmartObject data from one environment is not automatically deployed to a new environment. This is also done to prevent deployment packages from becoming too big. If you need to package the SmartBox data associated with a particular SmartObject, open the SmartObject node and select the option to include data.
-
Once you have selected the artifacts, click OK to add them to the package list. The Create Package page shows your selected artifacts. The right pane lists the artifact properties, data, dependencies, and what the artifact is used by. The number of items in the package shows in the bottom left corner. In the image below, the Properties tab is selected, allowing you to view the properties of the selected artifact. The top menu provides options for adding, removing, analyzing, creating or modifying variables for a package, and setting a form as the default.
- If you want a form to be opened immediately after the package is deployed, right click the form and select Set Default. Only one form can be configured as the default. (This option is often used if you need the deploying user to do additional configuration to allow the application to work, or if you want to show a form with additional information to the deploying user once the package is deployed).
. - The Remove option provides three options; Remove, Remove Item and Dependencies, and Remove All. Select artifacts in the package before using these options.
- The Dependencies tab shows what other artifacts are dependent on the one selected.
In the image below, for example, the Expense Claim Details SmartObject is dependent on the Expense Claim Categories and Expense Claim Header SmartObjects.
- The Used By tab shows what other artifacts the one selected one is used by.
In the image below, for example, the Expense Claim Details SmartObject is used by many other items.
- You can create variables for properties of any artifacts that need different values in the target environment (for example, service instance credentials). See Assigning Variables for more information.
Step 4: Finish
Click Finish to create and save the package. Remember that you must resolve any warnings and error messages shown in the Status column of an artifact before you can create the package. Double-click the status message to show more information about the warning or error.
If properties of packaged artifacts should be different in the target environment (for example, service instance credentials), you can create variables for those properties.
Assigning Deployment Package Variables
- Right-click the relevant property and select Assign variable. (If the Assign variable option does not appear, the field is not a property for which you can assign a variable.)
- The Variables dialog opens. Click the Add button.
- If you have already created a variable for this field, it is listed here where you can choose to use it.
- On the Edit Variable dialog, specify a Name, Description and Value for the variable. If you don't know what the value of a variable will be on the target environment, leave it blank as you can set the value during deployment.
- Click OK to assign this variable to the field.
- When you assign a variable, the Status column shows how many fields have been assigned that variable.
SmartObject data is excluded by default but you can choose to include it in the package. Only data in SmartBox SmartObjects can be included.
Right click the SmartObject and use the Package Data/Exclude Data option to enable or disable the data packaging for the SmartObject.
When deploying a package that includes SmartObject data, you have the option to create a new version of the SmartObject on the target environment if the SmartObject already exists, or to keep the target data.
If you change a SmartBox SmartObject to an Advanced SmartObject you will not be able to package the data.
Artifacts may be packaged as full objects or as referenced items. Referenced items are artifacts that are already deployed to the target environment. Referencing items that already exist on the target environment saves space and time when creating and deploying packages across environments, and also prevents artifacts from being overwritten. This is helpful when many solutions use a few common artifacts, such as employee data, product information, and a list of departments.
If an artifact already exists on the target environment, select the artifact and use the Package By Reference option to add just the reference to that object to the K2 package being created. The artifact type then shows that only a reference is to be packaged.
For example, if multiple workflows use an Employee SmartObject, the first package you create and deploy to a target environment contains the full Employee SmartObject artifact. Subsequent packages you create for other workflows that also use the Employee SmartObject should include the SmartObject by reference. The package will not contain the SmartObject definition, but when the package is deployed it will use the reference to create the required links and dependencies to the existing Employee SmartObject on the target environment.
The SharePoint Application Lifecycle Management concept paper details two scenarios (simple and complex) that use referenced items. Each scenario traces a decision path of what is included and what is packaged by reference.