OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM Need to send email to respective lead once a new lead is created

This topic contains 11 replies, has 3 voices, and was last updated by  shreyas 7 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #30380

    shreyas
    Participant

    Hi,

    we are required to send an email to the lead as soon as a new lead is created. we are not able to find out a way how to do it. we could not find any resource to this requirement from which we could get some idea.

    We found a link – Working with Process.yml which was similar to our requirement where in Process.yml configuration is done but we could not get clear idea about how email can be triggered on creating a lead.

    Please help in suggesting some good resource or brief explanation on how to get solution for this.

    Thanks & Regards,
    Shreyas S

Viewing 11 replies - 1 through 11 (of 11 total)
  • Author
    Replies
  • #30381

    Artem Liubeznyi
    Spectator

    Hi Shreyas,

    You were correct, this task should be handled via processes.

    If you need examples, please take a look at the autoresponse functionality in our system mailboxes. It does the similar job: auto-sends a reply, when a new email is received.

    Hope this helps!

    #30382

    Mike Kudelya
    Participant

    Hi,

    If you want to work with process, following this instructions:

    Add template with name my_lead_template and template content “This is new lead from template: {{ entity.name }}”

    Add custom bundle with src/Custom/Bundle/OroBundle/Resources/config/process.yml

    run this command inside root project directory:

    Don’t forget run job daemon there [your_site]/cron/job, click on Run Daemon button

    Unsure that you have user with email abc@example.com

    In this example the recipient will be the email you have entered into Lead -> Email, you can change “to: $email” to any value, for example “to: ‘example@oro.com'”

    #30383

    shreyas
    Participant

    Hi Mikekudelya,

    Thanks a lot for providing step by step Instructions on Process which serves my Requirement.This was exactly what we were looking for.we will get back if there are any issues faced.

    Thanks & Regards,
    Shreyas S

    #30384

    shreyas
    Participant

    Hi Mike,
    I am able to trigger the send email process when a New Lead is created. Thanks.But i am having a problem in associating the context(lead) with the mail to track it in activity list of that particular lead.
    I noticed that oro_activity_list table is inserting the required data from mail sent but is missing some data i.e: user_editor_id .Also the relation table (In My DB – oro_rel_c3990ba688a3cef599ef6a )which relates activity list with lead Id the insertion of data into this is missing. When I fill in the missing data manually by associating lead with activity Id . It will show up in Activity List Column of the Lead . Please need some suggestion on how to solve this issue.

    I tried writing a create entity using Activity List Entity in Process.yml itself where auto-mail trigger is done using a reference link : Create Entity Link. But it is not working.It gives an exception as follows while running cron job:

    Cron Job Error

    Please find the process.yml code given below:

    I am not aware on how to pass the parameters here . As per the table structure for oro_activity_list i have used all of them in Process.yml.

    Also, Cron Job Gets stopped very often. i have tried changing the timing in crontab using: crontab –e but it gives no effect i.e:

    Cron Job in UI runs only for some timespan like 40 minutes . But in linux PS command Cron is running continuously.

    Thanks & Regards,
    Shreyas S

    #30385

    Mike Kudelya
    Participant

    Hi,

    This is complicated way to add context. I found the action which does all work.
    Add to @send_email_template:

    and then add:

    action takes target_entity (lead) and add email context to it.
    Other interesting actions you can find there.

    #30386

    shreyas
    Participant

    Hi Mike,

    Thanks a lot for such a Quick Reply & providing me easy solution to the above problem.It Worked as expected.

    The Only issue now is that Cron gets automatically stopped after some time(approx: 40 Minutes).I am not sure on how to re run the cron linked for the send_mail_lead trigger for a timespan of some amount .So right now i am manually clicking the Run Daemon button in UI (i.e: myprojectdir/app_dev.php/cron/job).

    i have tried setting the crontab to the project directory i am working also as explained in above post.
    Please need some suggestions on how to solve this issue as i have not much worked with cronjobs.

    Thanks & Regards,
    Shreyas S

    #30387

    Mike Kudelya
    Participant

    Hi,

    You can go to cron/job url and look at cron jobs, maybe one of them red (exited with fatal or something like this) or setup php error log, maybe there will be errors. Also you can look at /app/logs directory.

    #30388

    shreyas
    Participant

    Hi Mike ,

    I tried looking at php logs. it didn’t give any exception nor the UI of project_url/cron/job had any exception(Please find the screenshot attached).
    Screenshot of Cron Job Finish status
    i also tried using shell to run daemon using >app/console oro:cron (&) also > app/console jms-job-queue:run but it gave the same problem.
    i also looked at crontab by editing the crontab configuration (crontab -e) to some other project path & done with >service crond restart but it had no effect on the
    cron running in UI . So i clicked on Run Daemon btn in UI, it worked fine by triggering mails & call logs but faced again same issue of cron job stopping after sometime.I am Wondering how crontab configuration change to different path is not affecting this cron job.

    I tried checking with the logs in app/logs/dev.log before & after the creating the Lead to check if any exceptions but couldn’t notice any exceptions occured.
    Please find the log before lead is created:

    Contd with log when lead is created..

    #30389

    shreyas
    Participant

    Log After lead is created (got this logs when i tried : >tail -f app/logs/dev.log And then created lead):

    I am still trying for some workaround on how to get rid of it.Please let me know if any suggestions/solutions that can help solve the problem.

    Thanks & Regards,
    Shreyas S

    #30390

    Mike Kudelya
    Participant

    Hi,

    I think that cron daemon stops very often is normal behaviour. I have found example how to setup cron jobs. This is very similar to what you did. I found interesting –max-runtime option.

    If you look at cron command you can see that firstly command run daemon, after that process jobs.

    #30391

    shreyas
    Participant

    Hi Mike,
    Thanks a lot for the solution . It helped.

    The issue i had was there was no PHP available in the provided path (usr/local/bin/php) so i removed it from crontab & used only :

    Its working now. Thanks a lot once again .

    Thanks & Regards,
    Shreyas S

Viewing 11 replies - 1 through 11 (of 11 total)

The forum ‘OroCRM’ is closed to new topics and replies.

Back to top