ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

Open-Source CRM software Forums OroCRM OroCRM – How do I? Questions scheduler of email campaign

This topic contains 5 replies, has 3 voices, and was last updated by  thomasEpsi 2 years, 2 months ago.

  • Creator
    Topic
  • #7825
    golriz.nourani
    golriz.nourani
    Participant

    Hi Sir

    I create a campaign email which assign Schedule :Deferred and I set scheduled for ten min later
    but scheduler was not work, and didn’t send email on schedule date.
    haw can I work with scheduler of orocrm? is there any page for jobs of scheduler?

    regards,

    Golriz

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #7826
    Dima Soroka
    Dima Soroka
    Oro Core

    Do you have cronjob configured on your instance?

    #7832
    golriz.nourani
    golriz.nourani
    Participant

    I run below command for cron but I get error:

    php app/console oro:cron –env=prod > /dev/null

    [RuntimeException]
    Impossible CRON expression

    or ————
    php app/console oro:cron –env=prod

    Processing command “oro:cron:integration:sync”: skipped
    Processing command “oro:cron:batch:cleanup”:

    [RuntimeException]
    Impossible CRON expression

    #7912

    thomasEpsi
    Participant

    Hi,

    i have the same problem, when i create a email campaign which assign Schedule deferred, for example 2 minutes later, nothing work.
    Whereas when i launch command oro:cron , the email campaign that i has created work well, because oro:cron launch the command oro:cron:send-email-campaigns .
    So without launch this command , nothing happen.
    I specify that daemon is running too.

    #7954

    thomasEpsi
    Participant

    I resolved the problem by implementing , the EmailCampaignHandler.
    I verify if the EmailCampaign has the param “schedule” in “deffered” , and if it is, i create a Job with command “oro:cron:send-email-campaigns” set the ExecuteAfter with the ScheduledFor value of the entity EmailCampaign then persist and flush the Job. So i can see my job “Pending” in the JobQueue , and when it’s the good date, my job become “Finished” , and i receive well the email.

    May be there are an other way , more performance , but nowadays i found just this.

    I know that this code work with the POST method. I think that , if it’s a PUT method, i should get the job which refer to the EmailCampaign and change the ExecuteAfter date
    namespace OroCRM\Bundle\CampaignBundle\Form\Handler;

    /**
    * Process form
    *
    * @param EmailCampaign $entity
    *
    * @return bool
    */
    public function process(EmailCampaign $entity)
    {
    $this->form->setData($entity);

    if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
    $this->form->submit($this->request);
    if (!$this->request->get(self::UPDATE_MARKER, false) && $this->form->isValid()) {
    $em = $this->registry->getManagerForClass('OroCRMCampaignBundle:EmailCampaign');
    $em->persist($entity);

    if(new \DateTime('now') == $entity->getCreatedAt()){ /// CREATE
    if($entity->getSchedule() == "deferred"){
    $job = new \JMS\JobQueueBundle\Entity\Job('oro:cron:send-email-campaigns');
    $job->setExecuteAfter($entity->getScheduledFor());
    $em->persist($job);

    }
    }
    $em->flush();

    return true;
    }
    }
    return false;
    }
    }

    #7957

    thomasEpsi
    Participant

    I resolved the problem by implementing , the EmailCampaignHandler.
    I verify if the EmailCampaign has the param “schedule” in “deffered” , and if it is, i create a Job with command “oro:cron:send-email-campaigns” set the ExecuteAfter with the ScheduledFor value of the entity EmailCampaign then persist and flush the Job. So i can see my job “Pending” in the JobQueue , and when it’s the good date, my job become “Finished” , and i receive well the email.

    May be there are an other way , more performance , but nowadays i found just this.

    I know that this code work with the POST method. I think that , if it’s a PUT method, i should get the job which refer to the EmailCampaign and change the ExecuteAfter date

    PS: sorry i couldn’t edit the last post

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

You must be logged in to reply to this topic.