VERIFIED SOLUTION i

Error message: "Cannot insert duplicate key row in object" within Portrait Dialogue

Product Feature: Errors
 

Issue

Receiving the following error within Portrait Dialogue Logs (MHDIALxx.g):

Operation failed
Dialog: xxx_ProcessMessages (5100)
Operation: Select (35900)
Branch#: 1
Exception type: EOleException
Error message: Cannot insert duplicate key row in object 'dbo.DLG_PARTICIPANT' with unique index 'IDX_UNIQUE_PART'. The duplicate key value is (XXXX, XXXXXXX, X, X)

Send MHDailogxx.log server errors logs to support if needed.

Cause

Duplicate records are caused by the issue in 6.0.1 related with generating sequence values, which is prone to using the same value for different records under some circumstances (thread race). This issue is fixed in 6.1.2 version or later.

Resolution

UPDATED: July 12, 2018
The ultimate fix would be to upgrade to Portrait Dialogue 6.1.2 or later.  
However, it is suggested that you use the below provided query to monitor for the future existence of these duplicate records in the PARTICIPANT table.  The action required in the event this query return results may vary, and will have to be addressed on a per-occurrence basis.
 
select
cd.CD_NAME,
d.DLG_NAME,
dbt.dbt_name as opstep_name,
dosl.dosl_moved_num_part as opstep_partmoved,
datediff(s, dosl.dosl_opr_start_datetime, dosl.dosl_opr_end_datetime) as opstep_dur,
CASE WHEN datediff(s, dosl.DOSL_OPR_START_DATETIME, dosl.DOSL_OPR_END_DATETIME) > 0 THEN  dosl.dosl_moved_num_part  / datediff(s, dosl.DOSL_OPR_START_DATETIME, dosl.DOSL_OPR_END_DATETIME) ELSE 0 END as pps,
dg_from.DG_NAME as dg_from,
dg_to.dg_name as dg_to,
dosl.dosl_opr_start_datetime,
dosl.dosl_opr_end_datetime,
dosl.dosl_priority as opstep_priority,
dot.DOT_NAME as op_name,
datediff(s, dol.DOL_OPR_START_DATETIME, dol.DOL_OPR_END_DATETIME) as op_dur,
dol.dol_execution_mode as execmode,
dol.dol_do_id as do_id,
dosl.dosl_dos_id as dos_id,
dol.dol_id,
dosl.dosl_id,
d.dlg_id,
dosl.DOSL_INTERNAL_ID
from
dlg_opr_spec_log dosl
join dlg_operation_log dol on dol.dol_id = dosl.dosl_dol_id
JOIN dlg_opr_spec dos on dos.dos_id = dosl.dosl_dos_id
JOIN dlg_operation do on dol.dol_do_id = do.do_id
JOIN dlg_opr_type dot on do.do_dot_id = dot.dot_id
JOIN DIALOGUE d on dol.DOL_DLG_ID = d.DLG_ID
JOIN CUST_DOMAIN cd on d.DLG_CD_ID = cd.CD_ID
join DLG_GROUP dg_from on dol.dol_from_dg_id = dg_from.DG_ID
JOIN DLG_GROUP dg_to on dosl.DOSL_TO_DG_ID = dg_to.DG_ID
JOIN dlg_branch_type dbt on dos.dos_dbt_id = dbt.dbt_id
where dosl.DOSL_INTERNAL_ID in (SELECT [DOSL_INTERNAL_ID]
  FROM [DLG_OPR_SPEC_LOG] WHERE DOSL_ID > (SELECT MAX(DOSL_ID)-50000 FROM DLG_OPR_SPEC_LOG)
  group by dosl_internal_id
having count(*) > 1 AND SUM(dosl_moved_num_part) > 0) AND  DOSL_ID > (SELECT MAX(DOSL_ID)-50000 FROM DLG_OPR_SPEC_LOG)
order by dosl_id

The duplicate keys will have to be removed if causing errors to further continue operations, if you need assistance contact Technical Support.