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()
- entity\attribute()
- entity\attributeFetched()
- entity\countRelated()
- entity\getLinkColumn()
- entity\hasLinkMultipleId()
- entity\isAttributeChanged()
- entity\isAttributeNotChanged()
- entity\isNew()
- entity\isRelated()
- entity\removeLinkMultipleId()
- entity\setAttribute()
- entity\sumRelated()
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.
Adds the list of ids.
Example:
$teamId = '661607e29a87ad894';
entity\addLinkMultipleId('teams', $teamId);
$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.
Note
$test = entity\attribute('name') is equivalent to $test = name.
Examples:
$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.
Example:
$originalAssignedUserId = entity\attributeFetched('assignedUserId');
entity\countRelated( )¶
The entity\countRelated() function returns a number of related records with an optional primary FILTER applied.
Example:
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.
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\hasLinkMultipleId( )¶
The entity\hasLinkMultipleId() function checks whether a Link Multiple field has a specific ID. Returns a boolean (True or False).
entity\isAttributeChanged( )¶
The entity\isAttributeChanged() function returns TRUE if the ATTRIBUTE of the record was changed.
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\isNew( )¶
The entity\isNew() function returns TRUE if the entity is new (being created) and FALSE if not (being updated).
entity\isRelated( )¶
The entity\isRelated() function checks whether a target entity is related with another entity represented by LINK and ID.
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\setAttribute( )¶
The entity\setAttribute() function sets an ATTRIBUTE with a VALUE.
Note
entity\setAttribute('stage', 'Closed Won') is equivalent to stage = 'Closed Won'.
Example:
entity\sumRelated( )¶
The entity\sumRelated() function sums related records by a specified FIELD with an optional primary FILTER.
Example:
FILTER is a name of a optional primary FILTER pre-defined in the system.
See Also¶
- Array Functions
- Datetime Functions
- Entity Functions
- Env Functions
- Ext Functions
- JSON Functions
- Language Functions
- Number Functions
- Object Functions
- Output Functions
- Password Functions
- Record Functions
- String Functions
- Mythradon Marketing
- Mythradon Sales
- Mythradon Service
- Mythradon System Administration
- Mythradon Tools