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

  • It depends on version of your Sugar instance.

    If 7.x or greater you can customize an endpoint which save such field somewhere.

    If 6.x you can customize an entrypoint to do the same.

    Both endpoint and entrypoint can be invoked by a js event from inside the button.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • 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