This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
With K2 Workdesk SmartStarter installed on K2 4.7, editing any rules on one SmartForm after upgrading to K2 5.1 returns an error:
"A control with the name 'com.K2.App.Workdesk.ItemView.Content' already exists Type: System.ArgumentException Source: SourceCode.Forms.Authoring Method Base Member Type: Method Name: EnsureUniqueControlName Module Scope Name: SourceCode.Forms.Authoring.dll Declaring Type Full Name: SourceCode.Forms.Authoring.ControlCollection Stack Trace: at SourceCode.Forms.Authoring.ControlCollection.EnsureUniqueControlName(String name) at SourceCode.Forms.Authoring.Control.set_Name(String value) at SourceCode.Forms.Utilities.Design.SmartFormsAnalyzerResolver.Visit(View instance) at SourceCode.Forms.Utilities.Design.SmartFormsAnalyzerResolver.ResolveView(Reference reference) at SourceCode.Forms.Utilities.Design.SmartFormsAnalyzerResolver.Resolve(Reference reference) at SourceCode.Forms.Utilities.Design.Analyzer.ResolveReferences(IEnumerable`1 references, HashSet`1 evaluatedReferences) at SourceCode.Forms.Utilities.Design.Analyzer.Analyze(Object target, Boolean filter, Dictionary`2 rebinds, List`1 unbinds, Boolean deepAnalyze) at SourceCode.Forms.Utilities.Design.Analyzer.ContainsErrors(Object target) at SourceCode.Forms.Utilities.Design.Analyzer.AnalyzeReferences(ReferenceCollection references) at SourceCode.Forms.Utilities.Design.Analyzer.Analyze(Object target, Boolean filter, Dictionary`2 rebinds, List`1 unbinds, Boolean deepAnalyze) at SourceCode.Forms.Utilities.RuleHelper.TransformAuthoringDefinitionToRuleDefinition(String context, String xmlDefinition, String stateID, Guid eventID, Boolean transformAll) at SourceCode.Forms.Rules.PartialPage.Page_Load(Object sender, EventArgs e)"
The issue is caused by a whitespace at the beginning of the control name in the [K2].[Form].[Control] table:
Please apply the following steps:
Before making any changes, please make sure to create a backup of your K2 database if you have not done so.
1. Execute the query below to retrieve the ID of the 'com.K2.App.Workdesk.ItemView.Content' control.
Copy the ID value out to a text editor.
Select * from [Form].[Control] where Name = 'com.K2.App.Workdesk.ItemView.Content'
2. Run the query below to update the [Name], [DisplayName], and [Properties] columns to remove the whitespace:
SET Name = LTRIM(Name),
DisplayName = LTRIM(DisplayName),
Properties = '<Property>
WHERE id='[ID from Step 1]'
Do not modify any database definition or database content unless specifically instructed to do so by K2. No changes to the K2 Database definition or content are supported unless specifically instructed by K2.
Please note: http://help.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm#Database_Reference.html