Skip to main content

GetByInternalId

Returns the object by it's internal ID.

Syntax

expression.GetByInternalId(id);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
idRequiredstringThe object internal ID.

Returns

object

Example

Get an object by its internal ID in a document.

// How to get the by internal id in a document?

// Get the by internal id using the document API.

const doc = Api.GetDocument();

const paragraph = doc.GetElement(0);
paragraph.AddText('Original paragraph text.');
const internalId = paragraph.GetInternalId();

const found = Api.GetByInternalId(internalId);

const resultParagraph = Api.CreateParagraph();
resultParagraph.AddText('Found object class type: ' + found.GetClassType());
resultParagraph.AddLineBreak();
resultParagraph.AddText('Found paragraph text: ' + found.GetText());
doc.Push(resultParagraph);