want to insert into another module's Table.

Hi Team,

I have added a custom button on custom entity next to SAVE and CANCEL.

On the click of custom button i want to pick some value from the FORM and want to insert into another module's Table.

  

What is right way to achieve it.

Thanks in advance.

Regards,

Deepak

Parents
  • Hi Liu Yunde,

    Simply you can use Sugarcrm Bean factory Query for insert or update data .

    form data send using Ajax.

    Insert Data—

    $bean = BeanFactory::newBean("Cases");

    $bean->name = 'Manish;

    $bean->description = $ticket_description;

    $bean->status = $ticket_status;

    $bean->where_did_you_find_us_c = $ticket_where_did_you_find_us;

    $bean->priority = $ticket_priority;

    $bean->product_c = $product;

    $sugar_case_id = $bean->save(); // Here getting generated case id......

    Update Data  —

    $bean = BeanFactory::getBean("Cases",$sugar_case_id); // Case id that you want to change

    $bean->name = 'manish';

    $bean->description = $ticket_description;

    $bean->status = $ticket_status;

    $bean->where_did_you_find_us_c = $ticket_where_did_you_find_us;

    $bean->priority = $ticket_priority;

    $bean->product_c = $product;

    $bean->save();

    if any issue please drop me message.

    Thanks

Reply
  • Hi Liu Yunde,

    Simply you can use Sugarcrm Bean factory Query for insert or update data .

    form data send using Ajax.

    Insert Data—

    $bean = BeanFactory::newBean("Cases");

    $bean->name = 'Manish;

    $bean->description = $ticket_description;

    $bean->status = $ticket_status;

    $bean->where_did_you_find_us_c = $ticket_where_did_you_find_us;

    $bean->priority = $ticket_priority;

    $bean->product_c = $product;

    $sugar_case_id = $bean->save(); // Here getting generated case id......

    Update Data  —

    $bean = BeanFactory::getBean("Cases",$sugar_case_id); // Case id that you want to change

    $bean->name = 'manish';

    $bean->description = $ticket_description;

    $bean->status = $ticket_status;

    $bean->where_did_you_find_us_c = $ticket_where_did_you_find_us;

    $bean->priority = $ticket_priority;

    $bean->product_c = $product;

    $bean->save();

    if any issue please drop me message.

    Thanks

Children
No Data