Code Fix: Duplicate sources created in XML
KB001830
PRODUCTIssue Description
When binding or unbinding a control to a field, duplicate sources are created in the view definition XML.
Cause
If a control is bound to a SmartObject field, then the source has a context type of association. If it is not bound, then the context type of the source would be external. In the XML code, instead of changing the context type when a field is bound/unbound, K2 added a new (duplicate) source node to the view definition with the corresponding context type.
Repro Steps
- Create a SmartObject.
- Create an associated SmartObject.
- Create a View from the first SmartObject.
- Delete the Drop-Down control.
- Add a new Drop-Down control.
- Configure the data source to load the associated SmartObject.
- Bind the control to the associated field.
- Finish the View.
At this point the duplicate Source was created in the XML.
Correct behavior: there should be two sources (1 Primary, and 1 Association). Reproduced issue will result in three sources (1 Primary, 1 Association, 1 External).
The following can be executed in SQL to view the XML entries:
SELECT TOP 1000 [ID]
,[SPID]
,[DateTime]
,[UserID]
,[TypeID]
,[Message]
,[Data]
,[Xml]
,[ClientStack]
FROM [K2].[Form].[AuditLog]
ORDER BY ID DESC
Expand the top XML result:
Resolution
- Ensure you have K2 4.7 installed.
- Install the K2 4.7 February 2017 Cumulative Update.
- Get the K2 4.7 February 2017 Cumulative Update FP3 from Regional Support.
- Install the K2 4.7 February 2017 Cumulative Update FP3 to apply the fix.
- Clear the Browser Cache.