Known Issue: Unable to deploy a package that contains a reference to a custom environment library field type. The Next and Finish buttons are disabled

  • 16 February 2021
  • 0 replies
  • 41 views

Userlevel 2
Badge +9
 

Known Issue: Unable to deploy a package that contains a reference to a custom environment library field type

KB002568

PRODUCT
K2 Five
K2 blackpearl 4.7

 

Issue

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.

Image

 

 

Cause

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.

 

Workaround

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:

.. K2BinSourceCode.EnvironmentSettings.Client.dll

 

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=4.0.0.0, 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=4.0.0.0, 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();
manager.InitializeSettingsManager();

// Create Plug-in
var pluginID = Guid.NewGuid().ToString();
var plugin = new EnvironmentPluginType(
 pluginID,
 "Mail Server Plugin", "SourceCode.Workflow.Plugins.MailServerBrowser.MailServerPlugin",
 "Field Browser Plugin",
 "SourceCode.Workflow.Plugins, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d"
);

manager.EnvironmentPluginTypes.Add(plugin);

// Create Field type
var fieldTypeID = Guid.NewGuid().ToString();
var fieldType = new EnvironmentFieldType(
 fieldTypeID,
 pluginID,
 "Mail Server", "SourceCode.Workflow.Design.EnvironmentSettings.SMTPField",
 "SourceCode.Workflow.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d",
 "Mail Server",
 false);

manager.EnvironmentFieldTypes.Add(fieldType);

 


0 replies

Be the first to reply!

Reply