i am able to to update the record and delete the record using bean method but i am not able to insert the data using bean my code for updating record are as below
$lead = new Lead();
$lead->retrieve($id);
$lead->email1 = $subscriber->email;
$lead->save();
As I said I haven’t tried it and what you say does make sense: why would the name of the class be different with respect to the name of the module?
In any case I gave an untested suggestion for you to try. Please post back the result of your test so that everyone can benefit from your findings in the future.
i Think for adding the records through beans we need to use name of the module and for updating name of the class
so it worked like this
Adding
$bean = BeanFactory::newBean('Leads'); //Create bean using module name
$bean->name = 'Example Record'; //Populate bean fields
$bean->save(); //Save
$record_id = $bean->id; //Retrieve the bean id
And For updating
$lead = new Lead(); / / object of class
$lead->retrieve($id); / / retrieve the bean
$lead->email1 = $subscriber->email; / / update it
$lead->save(); / / save it
Going to point out that using the following is some what the old way of loading the bean and the record required.
$lead = new Lead();
$lead->retrieve($id);
and this can be done using the BeanFactory using the following code.
$bean = BeanFactory::getBean(‘Leads’, $id );
however you can use either way both work but if you are hsing the BeanFactory to create the record I would use the BeanFactory to update the record to keep it simple.