According to documentation, using $this->addDomJS($data, 'vardefs'); within a custom view should make vardefs accessible in Javascript but the SUGAR.settings object is undefined
The vardefs (or any other object) should be accessible through JavaScript. https://docs.suitecrm.com/images/en/developer/vardefs.png
SUGAR.settings object is undefined, no error logs. suitecrm.log is empty, php error.log is empty too and no warnings or errors are shown in the browser console.
Sorry, I have no possible fix but maybe is related to issue #3006 and pr #3008
class ViewCustomDetail extends ViewDetail
{
public function __construct()
{
parent::__construct();
$this->useForSubpanel = true;
$this->useModuleQuickCreateTemplate = true;
$data = $this->getVardefsData('pud_Applicant');
$this->addDomJS($data, 'vardefs');
$jose = array(
'name' => 'Jose',
'country' => 'Argentina',
'footballTeam' => 'River Plate',
'footballTeamLastTitles' => array(
'Copa Sudamericana 2014',
'Copa Libertadores de Am茅rica 2015',
'Copa Suruga Bank 2015',
'Recopa Sudamericana 2015',
'Recopa Sudamericana 2016',
'Copa Libertadores de Am茅rica 2018',
),
);
$this->addDomJS(array($jose), 'developerData');
}
public function display()
{
parent::display();
}
}
class pud_ApplicantController extends SugarController
{
protected function action_detailview()
{
//set the new custom view
$this->view = 'customdetail';
}
}
I'm trying to read bean data from JavaScript so I can use it in a custom script to display a pdf document conditionally using PDFJS.
@Abuelodelanada you might want to take a look at this
Hi @pgorod
I'll take a look!
Hi @pgorod
I have found that this problem appears only if you use AjaxUI.
If you do not use AjaxUI everything works fine.
I keep investigating...
Most helpful comment
Hi @pgorod
I have found that this problem appears only if you use AjaxUI.
If you do not use AjaxUI everything works fine.
I keep investigating...