After you upgrade to K2 Five and attempt to deploy a package containing a reference to a custom environment library field type, you notice that the Next and Finish buttons are disabled (grayed out). There are no error messages and all status icons are green.
In K2 4.7 you could create custom environment library field types using Workspace. In K2 Five, however, the ability to create custom environment library fields types was removed.
If you upgraded both your 4.7 source and 4.7 target environments to K2 Five (assuming both have the custom environment library field type in place), your packages that include custom fields should still work.
If however, you upgraded your 4.7 source environment (that contains the custom environment library field type) and then install a clean K2 Five server, you are not able to deploy solutions containing custom field types. The custom environment library field type is not present in the target environment and you are not able to add it using K2 Management or Workspace.
Furthermore, custom environment library field types are not supported when deploying a K2 Five package (KSPX) to K2 Cloud environment.
The approach required to resolve this is to refactor your solution to remove the dependency on custom environment library field types. You can, however, build a utility that uses the K2 API to create missing custom field types in K2 Five. Below is information and a code sample to create a custom field type using the API.
Create a Custom Field Type using the K2 client API
Create a command line C# project that references the following assembly:
The two classes that you must use to create a custom environment library field include:
EnvironmentPluginType(string pluginTypeId, string friendlyName, string typeName, string pluginDescription, string pluginAssembly);
- pluginTypeId - This is a GUID identifier for your plugin
- friendlyName - This is the friendly name that will be displayed to the user
- typeName - This a namespace representation of the type of the plugin. e.g. SourceCode.Workflow.Plugins.MailServerBrowser.MailServerPlugin
- pluginDescription - This is the description of the plugin
- pluginAssembly - This is the assembly that is used or required by the plugin e.g. SourceCode.Workflow.Plugins, Version=22.214.171.124, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d
EnvironmentFieldType(string fieldTypeId, string pluginTypeId, string fieldName, string fieldType, string fieldAssembly, string fieldTypeDescription, bool addedByDefault);
- fieldTypeId - This is a GUID identifier for your field type
- pluginTypeId - This is the GUID of the plugin associated with your field type
- fieldName - This is the friendly name that will be displayed to the user
- fieldType - This a namespace representation of the type of the field type. e.g. SourceCode.Workflow.Design.EnvironmentSettings.SMTPField
- fieldAssembly - This is the assembly that is used or required by the field type e.g. SourceCode.Workflow.Design, Version=126.96.36.199, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d
- fieldTypeDescription - This is the description of the field type
- addedByDefault - This is a boolean value to indicate if this field type is added by default. Use false for any custom field types
Use the following code sample as a starting point for your utility, modifying the names and plug-in references for your environment:
// Initialize and Connect
EnvironmentSettingsManager manager = new EnvironmentSettingsManager(true);
manager.ConnectionString = GetConnectionString();
// Create Plug-in
var pluginID = Guid.NewGuid().ToString();
var plugin = new EnvironmentPluginType(
"Mail Server Plugin", "SourceCode.Workflow.Plugins.MailServerBrowser.MailServerPlugin",
"Field Browser Plugin",
"SourceCode.Workflow.Plugins, Version=188.8.131.52, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d"
// Create Field type
var fieldTypeID = Guid.NewGuid().ToString();
var fieldType = new EnvironmentFieldType(
"Mail Server", "SourceCode.Workflow.Design.EnvironmentSettings.SMTPField",
"SourceCode.Workflow.Design, Version=184.108.40.206, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d",