MarkEntityAsDuplicate

Description

Modifies the specified record to indicate that it is a duplicate of another record. A duplicate is a child. Calling MarkEntityAsDuplicate marks an entity as a child.

Given an entity, if HasDuplicates or IsDuplicate is True, you can call Link Object methods to retrieve parent and child data.

This method modifies the duplicate record but leaves the original unchanged. The state of the duplicate may change, depending on the schema. Appropriate links are added to the database. The duplicate is left in the modify state, which means that you can subsequently update its fields and that eventually you must eventually validate and commit it.

The administrator can set up different actions of type DUPLICATE. (For example, the actions might have different restrictions on when they are available, or they might have different hooks.) You must specify an action of type DUPLICATE in the duplicate_action_name parameter.

Syntax

VBScript


session.MarkEntityAsDuplicate duplicate, original, 
duplicate_action_name 

Perl


$session->MarkEntityAsDuplicate(duplicate, original, 
duplicate_action_name); 
Identifier
Description
session
The Session object that represents the current database-access session.
duplicate
The Entity Object that is to be marked as a duplicate (child) of original.
original
The Entity object that is the original data record.
duplicate_action_name
A String that specifies an action whose ActionType is DUPLICATE. This parameter must identify a valid action for the duplicate record.
Return value
None.

Examples

VBScript


set sessionObj = GetSession 
idName = GetFieldValue("id").GetValue 
set currentObj = sessionObj.GetEntity("defect", idName)

' Mark the entity with ID="SAMPL00000031" as a duplicate of this entity. 
' Use the action named "duplicate". 
set dupEntityObj = sessionObj.GetEntity("defect", "SAMPL00000031")
sessionObj.MarkEntityAsDuplicate dupEntityObj, currentObj, "duplicate" 

' Validate and commit the duplicate entity since it 
' is currently modifiable. 
error = dupEntityObj.Validate 
if error = "" then 
  dupEntityObj.Commit 
End If 

Perl


#Get a HCL Compass session

$sessionObj = $entity->GetSession();



#Mark the entity with ID="SAMPL00000031" as a duplicate of this 

#entity. Use the action named "duplicate".

$dupEntityObj = $sessionObj->GetEntity("defect", "SAMPL00000031");

$sessionObj->MarkEntityAsDuplicate( $dupEntityObj, $entity, "duplicate" );



#Validate and commit the duplicate entity since it is currently modifiable

$error = $dupEntityObj->Validate();

if ( $error eq "" ) {

   $dupEntityObj->Commit();

}