Hello again 
I have a little problem here, maybe just some basic syntax error but I can't figure it out.
My goal is to make espo auto-send email from my group email account using template '605ce24c7054e5bc4', to linked contact email address, when enum 'serviceState' changes to 'Vybavené' (means Done in my language).
I made this formula but no matter what status of serviceState enum i choose, everytime it sends template with no link to target entity. Thanks for any advice.

I have a little problem here, maybe just some basic syntax error but I can't figure it out.
My goal is to make espo auto-send email from my group email account using template '605ce24c7054e5bc4', to linked contact email address, when enum 'serviceState' changes to 'Vybavené' (means Done in my language).
I made this formula but no matter what status of serviceState enum i choose, everytime it sends template with no link to target entity. Thanks for any advice.
Code:
$svcDoneMail = record\create(
'Email',
'from', 'noreply@my-group-email.com',
'to', contact.emailAddress,
'status', 'Draft',
'isHtml', true,
'parentId', servis.Id,
'parentType', 'Servis'
);
ifThen(entity\isAttributeChanged(serviceState) && serviceState = ('Vybavené'),
ext\email\applyTemplate($svcDoneMail, '605ce24c7054e5bc4');
ext\email\send($svcDoneMail)
);

Comment