AnsweredAssumed Answered

Fields are not updating inTasks module using scheduled custom job

Question asked by Lavanya MR on Mar 7, 2018
Latest reply on Mar 28, 2018 by delsugar

Hi all,

I have scheduled a custom job in Tasks module to update fields everyday. Scheduled custom job is running successfully but fields were not updating. Previously i have scheduled custom job for Calls module using same method. Custom job is running as expected but not for the Tasks module. Can any one please help on this?

Please refer below code for more information:

1. custom_job_task.php

<?php

 

$job_strings[] = 'UpdateNumberOfDays';

 

function UpdateNumberOfDays()
{
    $moduleBean = BeanFactory::getBean("Tasks");
    $beanList = $moduleBean->get_full_list();
    if( $beanList != null )
    {
        foreach($beanList as $record )
        {
            if((strcmp($record->id,"57f7f222-f526-11e7-b198-02c6991e5099"))==0)
            {
                $test="Lavanya";
                $sql = "update tasks set tasks.description ='".$test."' where tasks.id='".$record->id."'";
                $result = $moduleBean->db->query($sql, true);
                
                $record ->update_date_modified = false;
                $record ->update_modified_by = false;
                $record ->tracker_visibility = false;
                $record ->in_workflow = false;
                $GLOBALS['log']->fatal('Scheduled tasks record updated successfully: '.$record->id);
                $GLOBALS['log']->fatal('Query is: '.$sql);
                $GLOBALS['log']->fatal('Result is: '.$result);
            }
        }
    }
    return true;
}
 
?>

 

2. en_us.custom_job_task.php

<?php

$mod_strings['LBL_UPDATENUMBEROFDAYS'] = 'UpdateNumberOfDays';
?>

 

 

Thanks & regards,

Lavanya

Outcomes