Announcement

Collapse
No announcement yet.

Schedule daily task to create on by its own

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Schedule daily task to create on by its own

    Can I configure a workflow like "Schedule daily task to create on by its own" for my backups? Please share any doc's/video. Thanks for your help.

  • #2
    Yes, you can. You just have to setup a job:

    And also you can plan specific job in hook for example:
    https://dubas.pro/c/?ea76adbef1ae1b7...inRD7abPnnhhE9

    Comment


    • chandra
      chandra commented
      Editing a comment
      Hi Bro, Do you have any code for custom job example? Thanks for your help. I am very new to ESPO/PHP

  • #3
    Thanks for your response. I will try your link.

    Comment


    • #4
      Hi chandra
      Just an addition when you create you custom job, you don't need a hook to schedule it, in fact the crm will pick it up and you can schedule it (through UI) by creating a new scheduled Job under Admin/Schedule Jobs/ (Create Schedule Job) button. after that you can select from the list your custom job and schedule it. see attached screenshot. I have just gone through this lately and it works fine.
      Attached Files
      Rabii
      Web Dev

      Comment


      • chandra
        chandra commented
        Editing a comment
        HI Rabi, Schedule jobs I have created as you said. I am worried about custom job its not working for me. Do you have any code for custom job?
        Thanks for your help. I am very new to ESPO/PHP

    • #5
      Thank you so much Rabii....appreciated your help

      Comment


      • #6
        Hi chandra

        Please see below a code, i have created a new folder under custom\Espo\Custom\Jobs the folder name is jobs and i have placed all my current jobs there, see below a custom php job for my application that increments a field by one (which i have scheduled to be run each day at 1:10 am), file name UpdateClaimDwellTime.php :

        Code:
        <?php
        namespace Espo\Custom\Jobs;
        
        use Espo\Core\ORM\EntityManager;
        use Espo\Core\Job\JobDataLess;
        
        class UpdateClaimDwellTime implements JobDataLess
        {
        protected $entityManager;
        
        public function __construct(EntityManager $entityManager)
        {
        $this->entityManager = $entityManager;
        }
        
        public function run(): void
        {
        $list = $this->entityManager
        ->getRepository('Claim')
        ->where([
        'stage!=' => ['Invoice Settled', 'Failed Processing']
        ])
        ->find();
        
        foreach ($list as $e) {
        $dwellTime = $e->get('dwellTime');
        $e->set('dwellTime', $dwellTime + 1);
        $this->entityManager->saveEntity($e);
        }
        }
        }
        Let me know if that helps, otherwise you can share what you want to achieve and i might help, always happy to help if i could.

        Cheers
        Rabii
        Web Dev

        Comment


        • chandra
          chandra commented
          Editing a comment
          Thank you so much Rabii,,,, I have followed same whatever you assisted,, created Jobs folder under that i have created same file name called UpdateClaimDwellTime.php and copy n paste your code and saved,
          Is this task php will run automatically , or do I need anything more?

        • rabii
          rabii commented
          Editing a comment
          you need to schedule the time from administration / scheduled jobs (create a new one and select your custom job and give it a cron time to run), see my comments below

      • #7
        These are my schedule jobs

        Comment


        • #8
          Hi chandra

          Once you created the custom job, when you go to administration -> Scheduled Jobs (then on top right of the page click on create scheduled job) and you will see a page where you can select your job from list (you will find your custom job in the list) choose your custom job and give it a cron time execution. see attached screenshot.
          Attached Files
          Rabii
          Web Dev

          Comment


          • chandra
            chandra commented
            Editing a comment
            This is my path: public_html/custom/Espo/Custom/Jobs/UpdateClaimDwellTime.php and schedule Jobs its not showing UpdateClaimDwellTime.

            Please find the below screen shot.. Thank you

        • #9

          Comment


          • #10
            the main purpose of this is "able to create a daily task on its own for my backups check"

            Comment


            • rabii
              rabii commented
              Editing a comment
              what do you mean by task for your backups check? can you explain further

            • chandra
              chandra commented
              Editing a comment
              Schedule daily task to create on its own..(Backup status check)

          • #11
            Maybe I have not created workflow properly. Do you have any related workflow kindly share with me. Thank you
            Last edited by chandra; 12-16-2021, 06:55 PM.

            Comment

            Working...
            X