GetFieldReferenceEntityDef

Description

Returns the type of record referenced by the specified field.

The specified field must contain a reference to other records. The type of the specified field must be one of the following: REFERENCE, REFERENCE_LIST, JOURNAL, or ATTACHMENT_LIST.

Syntax

VBScript


entitydef.GetFieldReferenceEntityDef field_name 

Perl


$entitydef->GetFieldReferenceEntityDef(field_name); 
Identifier
Description
entitydef
An EntityDef object corresponding to a record type in a schema.
field_name
A String that identifies a valid field name of entitydef.
Return value
An EntityDef object corresponding to the type of record referenced by the specified field.

Examples

VBScript


set sessionObj  = GetSession
set entityDefObj = sessionObj.GetEntityDef(GetEntityDefName())

' List the type of reference fields
nameList = entityDefObj.GetFieldDefNames()
For Each fieldName in nameList
   fieldType = entityDefObj.GetFieldDefType(fieldName)
   if fieldType = AD_REFERENCE Then
      set refEDefObj = entityDefObj.GetFieldReferenceEntityDef(fieldName)
      sessionObj.OutputDebugString refEDefObj.GetName()
   End If
Next 

Perl


$sessionObj = $entity->GetSession();

$entityDefObj = $sessionObj->GetEntityDef($entity->GetEntityDefName());



# List the type of reference fields

$nameList = $entityDefObj->GetFieldDefNames();

foreach $fieldName (@$nameList)
   {
 $fieldType = $entityDefObj->GetFieldDefType($fieldName);

 if ($fieldType eq $CQPerlExt::CQ_REFERENCE)

  {

  $refEDefObj = $entityDefObj->GetFieldReferenceEntityDef($fieldName);

  $sessionObj->OutputDebugString($refEDefObj->GetName());

  }

 }