AnsweredAssumed Answered

How change color fields in listview with scheduler?

Question asked by Eskender Bilyalov on Feb 3, 2018
Latest reply on Feb 7, 2018 by Francesca Shiekh

I create custom job with tutorial, and how change color  fields in listview?

./custom/modules/Accounts/logic_hooks.php

<?php
// Do not store anything in this file that is not part of thearray or the hook version. This file will be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'][] = Array();
$hook_array['before_save'][] = Array(1,
'Queue Job Example',
'custom/modules/Accounts/Accounts_Save.php',
'Accounts_Save',
'QueueJob');
?>

 

./custom/modules/Accounts/Accounts_Save.php

<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry
Point');
class Accounts_Save
{
function QueueJob(&$bean, $event, $arguments)
{
require_once('include/SugarQueue/SugarJobQueue.php');
// First, let's create the new job
$job = new SchedulersJob();
$job->name = "Account Alert Job - {$bean->name}";
$job->data = $bean->id;
// key piece, this is data we are passing to the job that
it can use to run it.
$job->target = "function::AccountAlertJob";
//function to call global
$current_user;
//user the job runs as
$job->assigned_user_id = $current_user->id;
// Now push into the queue to run
$jq = new SugarJobQueue();
$jobid = $jq->submitJob($job);
}
}
?>

 

./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/AccountAlertJob.php

 

<?php
function AccountAlertJob($job){
$bean = BeanFactory::getBean('Accounts', $job->data);
$bean->date_entered = "<h3 style='color: blue'>".$bean->date_entered."</h3>";
return true;
}

Outcomes