Domanda

I have installed sugar CRM for my personal learning purpose, I want to create a module and simple CRUD operation with smarty, I went through documentation but I didn't get proper idea. I have tried to create a module with Hello World and it worked but I didn't get the proper MVC flow. Can we only create a module through module builder? If someone know about this than please help me out.

Thanks

È stato utile?

Soluzione

You can add,update and delete in SugarCRM using following actions.

CRUD Handling:

Save Action:

$bean = BeanFactory::newBean($module);   //Create bean
$bean->name = 'Example Record';   //Populate bean fields
$bean->save();   //Save
$record_id = $bean->id;  //Retrieve the bean id

Update Action:

$bean = BeanFactory::getBean($module, $id);      //Retrieve bean
$bean->update_date_modified = false;      //Set modified flag
$bean->name = 'Updated Name';  //Fields to update
$bean->save();   //Save

Delete Action:

$bean = BeanFactory::getBean($module, $id);     //Retrieve bean
$bean->deleted = 1;    //Set deleted to true
$bean->save(); //Save
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top