How to add button to leads page to generate an email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • olympic
    Junior Member
    • Nov 2018
    • 1

    How to add button to leads page to generate an email

    I'm new to EspoCRM but am an experienced developer. I have a client that is making use of EspoCRM. The client is requesting that a button be added to the leads page (preferably in the detail panel) that when clicked by the user would generate a template email out to the lead they are currently viewing. The template email will need information both from the lead itself (name, email) but also the user that is working the lead (name) as well as a custom field we added to the user table.

    In reading through the documentation and the forum posts it appears that I would need to create a custom leads detail.js. Is that right? If so do I modify the one in client/modules/crm/src/views/lead/ or do I need to create a new one in client/custom/src/views/lead/ (that directory doesn't exist but from what I've read that is where it sounds like it would need to exist and if created I would also need to make sure it's defined in custom/Espo/Custom/Resources/metadata/clientDefs/lead.json. Is that correct?

    An alternate approach I've pondered is whether it would be easier to generate this template email when the lead status is changed. If that is the case, how would I go about defining the action to take upon the lead status change? It would need the name and email fields from the lead as well as the name and one custom field I set up from the user so the email can be generated and populated as requested by the client.

    My thought was just to call a basic php script passing in the needed lead and user parameters and have it generate the email. I just need a bit of guidance on how to properly accomplish this within the framework of EspoCRM. Thank you in advance for any assistance that can be provided.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello (John?),
    for this I would create notStorable field with own view.
    On this view you can call some backend action, what will parse your Email Template and send this email.
    You can check how works Send Test Email on Email Account view, or Report Sending, if you have Advanced Pack

    Comment

    Working...