Provide Email Template conditionally

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1603

    Provide Email Template conditionally

    I have email templates, which have to be applied by purpose. For example, I want to send an invitation out of a certain entity and the user should be able only to use an email template, that was created for that purpose. The entity from which it will be sent has an enum field, to choose the purpose.

    So I look for a solution that works as: If the purpose choosen in the entity is A, only offer Templates marked with purpose A as well.

    Is there such a possibility? I do not look for any if condition inside the template, that would not work for my case.
  • Kharg
    Senior Member
    • Jun 2021
    • 410

    #2
    I think it's definitely possible.
    I have my custom template extensions that opens up a modal and based on the account it shows just related templates, and after you select the template it will open the email compose windows.

    Comment


    • shalmaxb
      shalmaxb commented
      Editing a comment
      some hint, on how to achieve that?

    • Kharg
      Kharg commented
      Editing a comment
      Let me check if I can make my extension work globally without issues
  • Kharg
    Senior Member
    • Jun 2021
    • 410

    #3
    This is what I made up until now:
    Template where you have to define Entity and Account, you can also prefill from/to/cc/bcc for the template
    Click image for larger version

Name:	image.png
Views:	399
Size:	44.9 KB
ID:	89033

    ​Option Menu to select enabled entities
    Click image for larger version

Name:	image.png
Views:	329
Size:	21.4 KB
ID:	89034

    Email Button added if the record account and entity matches
    Click image for larger version

Name:	image.png
Views:	208
Size:	35.4 KB
ID:	89035

    The modal will show all the related templates found
    Click image for larger version

Name:	image.png
Views:	327
Size:	26.6 KB
ID:	89036

    It will then open the email compose window
    Click image for larger version

Name:	image.png
Views:	438
Size:	37.1 KB
ID:	89037​​​​

    Comment

    • esforim
      Active Community Member
      • Jan 2020
      • 2204

      #4
      You are not doing this automatic right?

      If it manual then one way (poor man workaround) I would achieve this is using "if" and giant text, DO NOT SEND, DO SOMETHING ELSE when certain status condition are not met.

      Otherwise Kharg seem to have some neat looking screenshot. I wonder if it can do relationship; for example if I a "Vendor" Contact in Case Entity, it will grab that person email instead of "All Contact" which is what Case is doing at the moment.
      Last edited by esforim; 03-09-2023, 03:06 AM.

      Comment

      • Kharg
        Senior Member
        • Jun 2021
        • 410

        #5
        esforim with my extension you could make a template for that specific Vendor and it will grab the "To" address in the template.

        of course it could also be adapted to cases like, it could take the Case primary contact email, but that's something I am not planning on doing for this extension.

        What can be done is adding a Contact filter to the template search so it will show templates for just the linked record contact/account/entity


        Maybe I could add filter settings in the Extension Settings menu, where you can select which fields to consider for the filter. I will think about it.
        Last edited by Kharg; 03-09-2023, 03:17 AM.

        Comment

        • esforim
          Active Community Member
          • Jan 2020
          • 2204

          #6
          Originally posted by Kharg
          esforim with my extension you could make a template for that specific Vendor and it will grab the "To" address in the template.
          Sound good! Without playing with it, it hard to tell... my visual capability is quite bad so not sure but: in my imagination it is good at the moment. Sometime I forgot to delete the "To:" and "CC:" and it too late, can only hope for the best they can ignore the email.

          Comment

          Working...