AnsweredAssumed Answered

Why does a custom scheduler job fail to update custom fields?

Question asked by paperless on Jun 18, 2014
Latest reply on Jul 15, 2014 by Francesca Shiekh
In v6.7.5 on-demand instance the following job fails to update custom fields:

$target = BeanFactory::getBean('Leads');
$where = "leads_cstm.status_c <> 'Lost' and leads_cstm.status_c <> 'Converted'";

$target_list = $target->get_full_list("",$where,true); 
if ($target_list != null && !empty($target_list)) {
 //the line below outputs the counts correctly in the log 
 $GLOBALS['log']->fatal("Processing {$counts} Leads");
 foreach($target_list as $bn)  {
    $bid =$bn->id;
   $lead = BeanFactory::getBean('Leads',$bid,array('use_cache'=>false));
    $lead->custom_fldb_c=gmdate('Y-m-d H:i:s',time());
   //the line below outputs the name [id] pair correctly in the log 
    $GLOBALS['log']->fatal("Updated Lead: {$nm} [{$bid}]");
return true;

Updating the same Leads fields via before_save logic hook works fine... 
Any pointers?