Announcement

Collapse
No announcement yet.

Send custom email when a comment is written in the Stream of a custom entity

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

  • Send custom email when a comment is written in the Stream of a custom entity

    I created a custom entity named "Project". Each time a comment is written in the Stream section of a project, I need to send the comment via email to the comment author AND to the target account of the project.

    The email subject must be structured as follows: "[<Project_ID>] New comment on <Project_Name>". Ex: [123] New comment on Sample Project.

    Does EspoCRM allow to solve a problem like this? If true, please provide guidance, useful docs, etc.

  • #2
    Hello,

    stream => note entity
    so you can make a beforeSave hook

    PHP Code:
    public function beforeSave(Entity $entity, array $options = array())
    {
    $post $entity->get('post');

    if(
    $entity->get('type') == 'Post' && $entity->isNew() && $entity->get('parentType') == 'Project') {
    $ent $this->entityManager->getEntity($entity->get('parentType'), $entity->get('parentId'));
    // 
    // SEND EMAIL. search on forum how send email..

    Maybe possible with Workflows.. not checked

    Comment


    • #3
      Hi,
      W/o codding you can create Workflow for the Note entity and try to build such logic https://docs.espocrm.com/administration/workflows/.

      Comment

      Working...
      X