Issue 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

  1. Create a SmartObject.
  2. Create an associated SmartObject.
  3. Create a View from the first SmartObject.
  4. Delete the Drop-Down control.
  5. Add a new Drop-Down control.
  6. Configure the data source to load the associated SmartObject.
  7. Bind the control to the associated field.
  8. 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:

Image

Image

Resolution

  1. Ensure you have K2 4.7 installed.
  2. Install the K2 4.7 February 2017 Cumulative Update.
  3. Get the K2 4.7 February 2017 Cumulative Update FP3 from Regional Support.
  4. Install the K2 4.7 February 2017 Cumulative Update FP3 to apply the fix.
  5. Clear the Browser Cache.

This a preventative fix, that will prevent the duplicates from getting created, but will not fix any issues related to duplicate sources.