[Vtigercrm-developers] Create new entity

Preexo preexo at googlemail.com
Mon Mar 21 03:46:59 GMT 2016


I am extending a custom extension with an AJAX action which is going to
create new Asset entities. But at the moment I am struggling with the
creation of new Assets. I am creating a new asset like this:

                $adb = PearDatabase::getInstance();
                $entity = CRMEntity::getInstance("Assets");
                $crmEntityId = $adb->getUniqueID('vtiger_crmentity');
                $entity->setModuleSeqNumber("increment","Assets");
                $assetRecord =
Vtiger_Record_Model::getCleanInstance("Assets");
                $assetRecord->set('mode','edit');
                $assetRecord->setEntity($entity);
                $assetRecord->setId($crmEntityId);
                $assetRecord->set("serialnumber", "foobar");
                $ret = $assetRecord->save();
                var_dump($ret);exit;

But I always get the message "Sorry! Attempt to access restricted file."
when calling the save method, all other things work fine.

I think I am not correctly creating the entity, what am I missing?
Thanks for any help!



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Create-new-entity-tp18679.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.


More information about the vtigercrm-developers mailing list