application/Espo/Core/Utils/Cron/ScheduledJob.php
public function addLogRecord($scheduledJobId, $status, $runTime = null, $targetId = null, $targetType = null)
    {
        if (!isset($runTime)) {
            $runTime = date('Y-m-d H:i:s');
        }

        $entityManager = $this->getEntityManager();

        $scheduledJob = $entityManager->getEntity('ScheduledJob', $scheduledJobId);

        if (!$scheduledJob) {
            return;
        }

        $scheduledJob->set('lastRun', $runTime);
        $entityManager->saveEntity($scheduledJob, ['silent' => true]);

        $scheduledJobLog = $entityManager->getEntity('ScheduledJobLogRecord');
        $scheduledJobLog->set(array(
            'scheduledJobId' => $scheduledJobId,
            'name' => $scheduledJob->get('name'),
            'status' => $status,
            'executionTime' => $runTime,
            'targetId' => $targetId,
            'targetType' => $targetType
        ));
        $scheduledJobLogId = $entityManager->saveEntity($scheduledJobLog);

        return $scheduledJobLogId;
    }
public function addLogRecord($scheduledJobId, $status, $runTime = null, $targetId = null, $targetType = null)
    {
        if (!isset($runTime)) {
            $runTime = date('Y-m-d H:i:s');
        }

        $entityManager = $this->getEntityManager();

        $scheduledJob = $entityManager->getEntity('ScheduledJob', $scheduledJobId);

        if (!$scheduledJob) {
            return;
        }

        $scheduledJob->set('lastRun', $runTime);
        $entityManager->saveEntity($scheduledJob, ['silent' => true]);

        $scheduledJobLog = $entityManager->getEntity('ScheduledJobLogRecord');
        $scheduledJobLog->set(array(
            'scheduledJobId' => $scheduledJobId,
            'name' => $scheduledJob->get('name'),
            'status' => $status,
            'executionTime' => $runTime,
            'targetId' => $targetId,
            'targetType' => $targetType
        ));
        $scheduledJobLogId = $entityManager->saveEntity($scheduledJobLog);

        return $scheduledJobLogId;
    }
public function addLogRecord ( $ scheduledJobId , $ status , $ runTime = null , $ targetId = null , $ targetType = null ) { if ( ! isset ( $ runTime ) ) { $ runTime = date ( 'Y-m-d H:i:s' ) ; } $ entityManager = $ this -> getEntityManager ( ) ; $ scheduledJob = $ entityManager -> getEntity ( 'ScheduledJob' , $ scheduledJobId ) ; if ( ! $ scheduledJob ) { return ; } $ scheduledJob -> set ( 'lastRun' , $ runTime ) ; $ entityManager -> saveEntity ( $ scheduledJob , [ 'silent' => true ] ) ; $ scheduledJobLog = $ entityManager -> getEntity ( 'ScheduledJobLogRecord' ) ; $ scheduledJobLog -> set ( array ( 'scheduledJobId' => $ scheduledJobId , 'name' => $ scheduledJob -> get ( 'name' ) , 'status' => $ status , 'executionTime' => $ runTime , 'targetId' => $ targetId , 'targetType' => $ targetType ) ) ; $ scheduledJobLogId = $ entityManager -> saveEntity ( $ scheduledJobLog ) ; return $ scheduledJobLogId ; }
Add record to ScheduledJobLogRecord about executed job

@param string $scheduledJobId
@param string $status

@return string ID of created ScheduledJobLogRecord
Add record to ScheduledJobLogRecord about executed job