Resolving "Unexpected error!" in Portrait HQ when opening a campaign using its activity in LiveView.


Opening a campaign using its activity in LiveView section of Portrait HQ causes "Unexpected error!" (An unexpected error has occurred. Please close your browser and re-start the HQ. Please contact your system administrator if this problem re-occurs.)
When an In market or a Completed campaign is opened from LiveView in Portrait HQ 2.0

User-added image

User-added image
by clicking on activity (shown in green below) and not the campaign (shown in red)

User-added image

then the following error appears:

User-added image


This happens because Control Group (which does not have any Channel Type associated to it) is used in a marketing activity and the code breaks in this scenario on the Activity Performance page.

User-added image


UPDATED: August 25, 2017
A workaround to avoid the problem is to:
  • Create a Dummy Channel in the Channel Type table by direct edit of table in the DB or issue an INSERT command. 
Insert  into [PortraitPSR].[dbo].[ChannelType]
  • Associate the ChannelType ID to the Control Group treatment Type.
  • Associate the ID of the Channel Type created in the first step, to the ChannelTypeId column for record for Control Group in TreatmentType table.
Update [PortraitPSR].[dbo].[TreatmentType]
set ChannelTypeId = (select Id from [PortraitPSR].[dbo].[ChannelType] where Name = 'DUMMY_FOR_CONTROL_GROUP')
where Name = 'Control group' and IsControlGroup = 1