Announcement

Collapse
No announcement yet.

Filter leads emails with custom field (Enum)

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

  • Filter leads emails with custom field (Enum)

    HI,

    I'm working on a BPM set on a custom target entity type.
    This custom entity has some leads attached to it.
    The BPM sends email to those leads. I have to select only some leads from those attached in the custom target entity (based on a enum field in the Leads entity)

    I don't manage to achieve... What would be the best way to do that process, please ?

    Thanks in advance.

  • #2
    Hi,

    It's tricky.

    Assuming you have the latest EspoCRM version (v5.9.2).

    1. Entity Manager: Create an additional relationship with leads, with a name, for example, 'leadsNew'.

    2. BPM flowchart: Then use formula function findRelatedMany https://docs.espocrm.com/administrat...indrelatedmany that will fetch all related lead ids that met the needed criteria.
    Code:
    $ids = record\findRelatedMany('YourEntityType', id, 'leads', 100, null, null, 'enumFieldName=', 'neededValue');
    3. BPM flowchart: Then use record\relate https://docs.espocrm.com/administrat.../#recordrelate to link these leads through 'leadsNew' relationship.
    Code:
    record\relate('YourEntityType', id, 'leadsNew', $ids);
    4. BPM flowchart: Then you will be able to use Send Message Task that will send email to all leads related through 'leadsNew' relationship.
    Last edited by yuri; 05-28-2020, 08:52 AM.

    Comment


    • #3
      Thanx a lot YuriKuzn !

      I don't have the latest EspoCRM (v5.8.5)

      I'm going to try that anyway and keep you in touch

      Comment


      • #4
        These functions won't work on v5.8.5.

        Comment


        • #5
          Ok thank you.
          I'm waiting for the admin to answer me about upgrading to the last version

          Comment


          • #6
            Note, that if you use Send Message Task in BPM and have multiple recipients, it will send a single email with multiple recipients in "TO" address.

            You can create Target List dynamically, populate it with recipients using formula, and then create MassEmail record with a created Target List.

            Or you can use formula to send multiple emails. In 5.9.3 version there will be 'while' function that will allow to loop through the list of IDs and send separate emails to each one. It's possible to send emails with formula.
            Last edited by yuri; 05-28-2020, 01:22 PM.

            Comment


            • #7
              Originally posted by WillRD View Post
              Ok thank you.
              I'm waiting for the admin to answer me about upgrading to the last version
              You can manually upgrade it like me. First upgrade to 5.9.1 then manually patch those commit in your system.

              But you are waiting for "Admin", is that your internal admin or your server/host admin?

              Comment


              • #8
                Originally posted by yurikuzn View Post
                Note, that if you use Send Message Task in BPM and have multiple recipients, it will send a single email with multiple recipients in "TO" address.

                You can create Target List dynamically, populate it with recipients using formula, and then create MassEmail record with a created Target List.

                Or you can use formula to send multiple emails. In 5.9.3 version there will be 'while' function that will allow to loop through the list of IDs and send separate emails to each one. It's possible to send emails with formula.
                Yes It works fine Like that !
                Thanks a lot

                Comment


                • #9
                  Originally posted by espcrm View Post

                  You can manually upgrade it like me. First upgrade to 5.9.1 then manually patch those commit in your system.

                  But you are waiting for "Admin", is that your internal admin or your server/host admin?
                  Thank you for the tip.
                  I do have to refer to an internal administrator (CTO). I would have done it myself otherwise

                  Comment


                  • #10
                    Originally posted by yuri View Post
                    Note, that if you use Send Message Task in BPM and have multiple recipients, it will send a single email with multiple recipients in "TO" address.

                    You can create Target List dynamically, populate it with recipients using formula, and then create MassEmail record with a created Target List.

                    Or you can use formula to send multiple emails. In 5.9.3 version there will be 'while' function that will allow to loop through the list of IDs and send separate emails to each one. It's possible to send emails with formula.
                    How can I loop through list of IDs (ver 5.9.4)?

                    Comment

                    Working...
                    X