What is the query for getting "My Call Queue"

Hello,

Sorry in advance if my question is unclear, I am still new to sugarCRM and I am not quite sure how to explain this either. I got the leads of a logged in user by doing this query “SELECT * FROM leads WHERE assigned_user_id = '”.$current_user->id."’ AND deleted = 0 ORDER BY date_entered DESC".

Maybe someone would know the query to get “My Call Queue” of a logged in user. I know there is a dashlet that displays this and im having trouble tracing where the query is used.

Thank you

First of all have a look at THIS thread to avoid using direct sql queries.

If you need Calls assigned to current user you can do something like this.

$calls = BeanFactory::getBean(‘Calls’);
$calls->get_full_list(‘calls.name’,‘calls.assigned_user_id="’.$current_user->id.’"’);

foreach($calls as $item)
{
var_dump($item->name);
}