SugarCRM 9 bean->save() not working in endpoint

Hello Folk,

I am trying to create case in Sugarcrm when webhooks fire from my external application. For that I have created one endpoint. Endpoint is working fine in my case. But problem is faced when I am trying to save record with BeanFactory.

Below is my endpoint code. But after this line $checkcase->save(); code is not getting executed. Please help to troubleshoot this issue.


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

class DT_FD extends SugarApi
public function registerApiRest()
return array(
'DT_FD_EndPoint' => array(
'reqType' => array('GET','POST'),
'noLoginRequired' => true,
'path' => array('DT_FreshDesk', 'Tickets'),
'pathVars' => array('',''),
'method' => 'DT_FD_Functions',
'shortHelp' => 'Freshdesk End Point',
'longHelp' => '',

public function DT_FD_Functions($api, $args)
global $db;

$ticketid = $_POST['freshdesk_webhook']['ticket_id'];

$checkcase = BeanFactory::newBean("Cases");
$checkcase->name = "Lokesh";

$checkcase->ticketid = $ticketid;
$checkcase->save();    //code is not executing after this line.
return true;