AnsweredAssumed Answered

Problem changing a custom field with scheduler based on another one

Question asked by Giovanni Marazzi on Jan 8, 2018
Latest reply on Jan 10, 2018 by Francesca Shiekh
Branched to a new discussion

Its been a week now that i am trying to make this code work could someone point out what am i doing wrong?

I tried printing a line everytime a new row of the database is processed but it doesn't change anything. I also put in anex the vardefs and SQL schema. 


$sql = "SELECT, T5.lftm_mes_referencia_c FROM ger01_gerenciamentocliente T1 INNER JOIN
ger01_gerenciamentocliente_contacts_c T2 ON = T2.ger01_gere60bccliente_idb AND T2.deleted = 0 INNER JOIN
contacts T3 ON = T2.ger01_gerenciamentocliente_contactscontacts_ida AND T3.deleted = 0 INNER JOIN
contacts_cstm T4 ON T4.id_c = INNER JOIN
ger01_gerenciamentocliente_cstm T5 ON T5.id_c = WHERE T1.deleted = 0;";

while ($row = $GLOBALS['db']->fetchByAssoc($result)) {

$contact_bean = BeanFactory::retrieveBean('contacts', $row['id'], array('disable_row_level_security' => true));

if(!empty($contact_bean->lftm_data_ativacao_c)) {
if($contact_bean->lftm_data_ativacao_c > $row['lftm_mes_referencia_c']) {
$contact_bean->lftm_data_ativacao_c = $row['lftm_mes_referencia_c'];
} else {
$contact_bean->lftm_data_ativacao_c = $row['lftm_mes_referencia_c'];