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.
- CreatorTopic
- January 4, 2015 at 11:36 pm #28303
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
- CreatorTopic
- AuthorReplies
- January 5, 2015 at 2:16 am #28304
Do you have cronjob configured on your instance?
January 6, 2015 at 1:37 am #28305I run below command for cron but I get error:
php app/console oro:cron –env=prod > /dev/null
[RuntimeException]
Impossible CRON expressionor ————
php app/console oro:cron –env=prodProcessing command “oro:cron:integration:sync”: skipped
Processing command “oro:cron:batch:cleanup”:[RuntimeException]
Impossible CRON expressionJanuary 8, 2015 at 8:39 am #28306Hi,
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.January 9, 2015 at 7:35 am #28307I 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;
}
}January 9, 2015 at 8:27 am #28308I 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
12345678910111213141516171819202122232425262728293031323334/*** 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()){ /// CREATEif($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;}}PS: sorry i couldn’t edit the last post
- AuthorReplies
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.