I have come across a situation where i noticed that in Formula script you can access nested relationships but in API Before-Save script it doesn't work, see code example below for Case entity:
Formula script code
The code is executed and description is filled with the message because we could check if the assignedUserId on the linked account is empty/null.
Api Before-save script code
This code is not working and throw an error 500, below the log message (seems that we can't check nested relationships here)
Is this by design or is there an issue ? Not sure if this is a bug or not?
Formula script code
PHP Code:
if (!account.assignedUserId){
description = "Account does not have assigned user.";
}
Api Before-save script code
PHP Code:
if (!account.assignedUserId){
$message = "Account does not have assigned user.";
recordService\throwConflict($message);
}
PHP Code:
[2023-09-01 09:30:30] ERROR: (0) Can't use an entity w/o ID.; POST /Case; line: 73, file: \application\Espo\ORM\Repository\RDBRelation.php
Comment