AnsweredAssumed Answered

sugarQuery Unknown Error (4096)

Question asked by Adrian Dinu on Jul 22, 2015
Latest reply on Jul 23, 2015 by Adrian Dinu
I'm trying this simple sugarQuery code:

<?php
// WARNING: The contents of this file are auto-generated.
//Merged from custom/Extension/application/Ext/Utils/currency_list.php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 
require_once('include/SugarQuery/SugarQuery.php');
//require_once('data/SugarBean.php');

$sq = new SugarQuery();
$bean = BeanFactory::newBean('Accounts');
$sq->select(array('id','name'));
$sq->from($bean, array('team_security' => false));
$result = $sq->execute();

The error I'm getting is:
Unknown Error (4096): Argument 1 passed to SugarQuery::from() must be an instance of SugarBean, null given, called in /var/www/sugar_fever/custom/application/Ext/Utils/custom_utils.ext.php on line 15 and defined occurred in

So it seems BeanFactory::newBean('Accounts') is returning null. Anyone knows why that could be? I also tried with other modules and no luck. I tried including data/SugarBean.php and data/BeanFactory.php but nothing changed. I'm new to Sugar development so forgive me if this is basic stuff. 
I'm on version 7.6.0.0 Enterprise edition.

Outcomes