OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums 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 9 years, 3 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
  • #28303

    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
  • #28304

    Dima Soroka
    Keymaster

    Do you have cronjob configured on your instance?

    #28305

    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

    #28306

    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.

    #28307

    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;
    }
    }

    #28308

    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)

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top