"Data not available" error message after editing custom dropdown field

I'm working in a 7.6.1.0 Sugar Professional instance. I created the dropdown field sales_person_c in the Accounts module, which will later list all the users with certain roles. To accomplish this I replaced the field vardefs with the following:

$dictionary['Account']['fields']['sales_person_c']['labelValue']='Sales Person';
$dictionary['Account']['fields']['sales_person_c']['dependency']='';
$dictionary['Account']['fields']['sales_person_c']['visibility_grid']='';
$dictionary['Account']['fields']['sales_person-c']['function']= 'populateOption';
$dictionary['Account']['fields']['sales_person_c']['functionBean']= '';
$dictionary['Account']['fields']['sales_person_c']['options']= '';
$dictionary['Account']['fields']['sales_person_c']['default']= '';
$dictionary['Account']['fields']['sales_person_c']['required']= true;
$dictionary['Account']['fields']['sales_person_c']['reportable']= true;

And put the following file in custom/Extension/application/Ext/Utils/:

<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

function populateOption(){

$GLOBALS['log']->fatal("populateOption");
$select = "SELECT u.id AS ID, CONCAT(IFNULL(u.first_name,''),' ',IFNULL(u.last_name,'')) users_full_name
FROM
(
SELECT IFNULL(users.id,'') id, IFNULL(users.first_name,'') first_name, IFNULL(users.last_name,'') last_name
FROM users
JOIN acl_roles_users rel ON rel.user_id = users.id and rel.deleted = 0
JOIN acl_roles rol ON rol.id = rel.role_id and rol.deleted = 0
WHERE ((1=1))
AND users.deleted=0 and users.status = 'Active'
AND rol.name = 'Role CRM 1'
ORDER BY first_name
) AS u
JOIN acl_roles_users rel ON rel.user_id = u.id and rel.deleted = 0
JOIN acl_roles rol ON rol.id = rel.role_id and rol.deleted = 0
WHERE rol.name = 'Salesman'
ORDER BY users_full_name";
$result = $GLOBALS['db']->query($select, TRUE, "Error: ");
$GLOBALS['log']->fatal("populateOption - Query realizada");
$list['']='';
while($row = $GLOBALS['db']->fetchByAssoc($result)){
$list[$row['ID']] = $row['users_full_name'];
$GLOBALS['log']->fatal("populateOption - ".$row['users_full_name']);
}
return $list;
}
?>

(I know the query works fine as I tested it in another script)

After a Quick Repair and Rebuild, when I try to access an Accounts record I get the following error message:

Data not available

Page does not exist or you do not have permission to access this page.

Go back to previous page.

And this error log in the browser console:

http://example.com/Sugar7/rest/v10/Accounts/enum/sales_person_c Failed to load resource: the server responded with a status of 404 (Not Found)

The populateOption function isn't being executed (there's nothing being logged).

Does anyone know where to start here?

As an addition, this is something I did in a 7.5 version before and worked just fine.

Thanks,

Rodrigo Morchio

Parents Reply Children
No Data