[Vtigercrm-developers] Create new entity

Preexo preexo at googlemail.com
Mon Mar 21 07:50:40 GMT 2016


Thanks for your answer.
Yes, the ownership is fine, the file permission as well and I only get the
error once I call the $assetRecord->save(); method.
Any other idea what can cause this error?


Christophe Humbert wrote
> Hello
> 
> did you check the permissions of your custom extensions files on the
> server?
> 
> KR
> On Mar 21, 2016 5:17 AM, "Preexo" <

> preexo@

> > wrote:
> 
>> 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.
>> _______________________________________________
>> http://www.vtiger.com/
>>
> 
> _______________________________________________
> http://www.vtiger.com/





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


More information about the vtigercrm-developers mailing list