GetEntityByDbId
Description
Returns the requested record (Entity) using the record's unique id.
Use this method to get a record whose database ID you know. You can get the database ID of a record by calling the GetDbId method of the corresponding Entity object.
To request the record using its visible ID instead of its database ID, use the GetEntity method.
Note: For more information on DBIDs, see Working with records.
Syntax
Perl
$session->GetEntityByDbId(entitydef_name, db_id);
- Identifier
- Description
- session
- The Session object that represents the current database-access session.
- entitydef_name
- A String that identifies the name of the record type to which the desired record belongs.
- db_id
- A Long that is the number used by the database to
identify the record.
The unique ID of the record (Entity).
- Return value
- Returns an Entity Object corresponding to the requested record.
Example
Perl
#Assume you have $entityObj, an Entity Object
#Save the session and record id for later use:
$sessionObj = $entityObj->GetSession();
$dbid = $entityObj->GetDbId();
# ...
#Later, to get the record again:
$entityObj = $sessionObj->GetEntityByDbId("defect",$dbid);