Skip to content

Entity Functions

Functions in the Entity group interact with a specific target record. Within the formula-script context, only one target record can be active at any time. For a Before Update Script, the target record is the one currently being updated.

Mythradon supports the following Entity functions:


entity\addLinkMultipleId( )

The function entity\addLinkMultipleId() is designed to append either a single ID or a list of IDs to the values within a Link Multiple field.

entity\addLinkMultipleId() adding a single ID value
entity\addLinkMultipleId(LINK, ID): NULL
entity\addLinkMultipleId() adding a list of ID values
entity\addLinkMultipleId(LINK, ID_LIST)

Adds the list of ids.

Example:

entity\addLinkMultipleId() Example 1
$teamId = '661607e29a87ad894';

entity\addLinkMultipleId('teams', $teamId);
entity\addLinkMultipleId() Example 2
$teamId = '661607e29a87ad894, ';

entity\addLinkMultipleId('teams', $teamId);

Add 'someTeamId' to 'teams' field.


entity\attribute( )

The entity\attribute() function eturns the ATTRIBUTE value of a target record. It's also possibe to fetch an attribute of a related record.

entity\attribute()
entity\attribute(ATTRIBUTE): MIXED

Note

$test = entity\attribute('name') is equivalent to $test = name.

Examples:

entity\attribute() Example
$assignedUserId = entity\attribute('assignedUserId');
$accountName = entity\attribute('account.name');

output\printLine($assignedUserId);
output\printLine($accountName);


entity\attributeFetched( )

The entity\attributeFetched() function returns an ATTRIBUTE value that was set when a target record was fetched from database. Before it was modified.

entity\attributeFetched()
entity\attributeFetched(ATTRIBUTE): MIXED

Example:

entity\attributeFetched() Example
$originalAssignedUserId = entity\attributeFetched('assignedUserId');


entity\countRelated( )

The entity\countRelated() function returns a number of related records with an optional primary FILTER applied.

entity\countRelated()
entity\countRelated(LINK, [FILTER]): INTEGER

Example:

entity\countRelated()
$numberOfOpenOpportunities = entity\countRelated('opportunities', 'open');


entity\getLinkColumn( )

The entity\getLinkColumn() function retrieves the value of a specified column from a related entity record. It takes the relationship LINK name, the ID of the entity, and the name of the COLUMN whose value is needed.

entity\getLinkColumn()
entity\getLinkColumn(LINK, ID, COLUMN): MIXED

This function returns the value of the COLUMN from the linked entity, with the return type depending on the nature of the data in that COLUMN.

Example:

entity\getLinkColumn() Example
entity\getLinkColumn('targetLists', 'TARGET_LIST_ID', 'optedOut');


entity\hasLinkMultipleId( )

The entity\hasLinkMultipleId() function checks whether a Link Multiple field has a specific ID. Returns a boolean (True or False).

entity\hasLinkMultipleId()
entity\hasLinkMultipleId(LINK, ID): BOOLEAN


entity\isAttributeChanged( )

The entity\isAttributeChanged() function returns TRUE if the ATTRIBUTE of the record was changed.

entity\isAttributeChanged()
entity\isAttributeChanged(ATTRIBUTE): BOOLEAN

Example:

entity\isAttributeChanged() Example
$statusChanged = entity\isAttributeChanged('status');

$statusChanged = entity\isAttributeChanged(status); // Invalid because ATTRIBUTE is not a string or constant. Missing quotes.

Note

The ATTRIBUTE is a STRING value that needs to be enclosed in quotes or a variable.


entity\isAttributeNotChanged( )

The entity\isAttributeNotChanged() function returns TRUE if the ATTRIBUTE of the record was not changed.

entity\isAttributeNotChanged()
entity\isAttributeNotChanged(ATTRIBUTE): BOOLEAN


entity\isNew( )

The entity\isNew() function returns TRUE if the entity is new (being created) and FALSE if not (being updated).

entity\isNew()
entity\isNew(): BOOLEAN


entity\isRelated( )

The entity\isRelated() function checks whether a target entity is related with another entity represented by LINK and ID.

entity\isRelated()
entity\isRelated(LINK, ID): BOOLEAN


entity\removeLinkMultipleId( )

The entity\removeLinkMultipleId() function deletes a specific ID from a Link Multiple field in an entity record. This action helps manage dynamic relationships between records directly through specified link fields.

entity\removeLinkMultipleId()
entity\removeLinkMultipleId(LINK, ID): NULL


entity\setAttribute( )

The entity\setAttribute() function sets an ATTRIBUTE with a VALUE.

entity\setAttribute()
entity\setAttribute(ATTRIBUTE, VALUE): NULL

Note

entity\setAttribute('stage', 'Closed Won') is equivalent to stage = 'Closed Won'.

Example:

entity\setAttribute() Example
entity\setAttribute('stage', 'Closed Won');


entity\sumRelated( )

The entity\sumRelated() function sums related records by a specified FIELD with an optional primary FILTER.

entity\sumRelated()
entity\sumRelated(LINK, FIELD, [FILTER]): INTEGER | FLOAT

Example:

entity\sumRelated() Example
entity\sumRelated('opportunities', 'amountConverted', 'won')

FILTER is a name of a optional primary FILTER pre-defined in the system.


See Also