Announcement

Collapse
No announcement yet.

Note about Post / Mentions - internal email client question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • lazovic
    replied
    ShulzR,

    Could you please show what your Workflow looks like in its entirety, as well as the full formula that is written in the Execute Formula Script Action?

    Leave a comment:


  • ShulzR
    replied
    EspoCRM v 6.1.4, Advanced Pack 2.7.0​

    Leave a comment:


  • lazovic
    commented on 's reply
    It is very strange.
    Please tell me which version of EspoCRM and Advanced Pack are you using?

  • ShulzR
    replied
    Thank You lazovic for replay!
    Unfortunately, the following error appears in the logs:​
    PHP Code:
    ERRORWorkflow[63244b811905e06cb]: Action failed [executeFormulawith cid [0], details: function: ext\email\sendindex1should bestring. [] []
    ​ 

    Leave a comment:


  • lazovic
    replied
    ShulzR,

    Please try to create a Workflow with Entity Type Note and Trigger Type After record created.
    Select the Action Execute Formula Script and paste this formula:
    Code:
    $crmURL = 'https://test.espocloud.com/#'; // change it to your instance URL with adding # character
    
    $parentId = entity\attribute('parentId');
    $parentName = entity\attribute('parentName');
    $parentType = entity\attribute('parentType');
    $post = entity\attribute('post');
    
    $createdByName = entity\attribute('createdBy.name');
    
    $usernameCatch = string\match($post, '/@\S*/');
    $username = string\substring($usernameCatch, 1);
    $usernameId = record\findOne('User', 'createdAt', 'desc', 'userName=', $username);
    
    $userEmailAddress = record\attribute('User', $usernameId, 'emailAddress');
    
    $parentEntityAddress = string\concatenate($crmURL, $parentType, '/view/', $parentId);
    
    $body = string\concatenate('You have been mentioned by the user ', $createdByName, '. Post: ', $post, '. See in CRM: ', $parentEntityAddress);
    
    ifThen(
    string\contains($post, $usernameCatch),
    $id = record\create(
    'Email',
    'to', $userEmailAddress,
    'subject', '[CRM] Mentions',
    'body', $body,
    'isHtml', true,
    'status', 'Draft')
    );
    
    ext\email\send($id);

    You can change the body of email in the $body variable. But keep in mind that you can't do formatting this way (paragraphs, bold type, etc.).
    Last edited by lazovic; 09-30-2022, 12:25 PM.

    Leave a comment:


  • ShulzR
    replied
    I tried to do it with workflow but {{post}} doesn't work :/
    Attached Files

    Leave a comment:


  • Note about Post / Mentions - internal email client question

    Hi,
    Users have the option selected in the preferences: Email notifications about mentions in posts​.
    They receive notifications to external e-mail clients, but the internal EspoCRM e-mail client does not have these e-mails. Why?
    Is it possible somehow email about the post/mentions were also visible in the internal e-mail client?​
Working...
X