Auto fill a relate field from parent to custom child module

In this tutorial, I will explain how to Auto fill a relate field from parent module to custom child module
Custom Hello module has the relationship with opportunity and Account.

Relationships :

1. One to many relationships between Hello module and Opportunity

2. One to many relationships between Hello module and Account.

Opportunity detail view has Hello module subpanel as shown in the image below. When using click on create button of Hello subpanel

quick create form appears.

Quick create form has Opportunities field fill with opportunity name.

The question is : How to auto fill Accounts when quick create view is rendered ?

blog-autofill

Account field name – test_hello_accounts_name

Account field id – test_hello_accountsaccounts_ida

Steps

1. Copy file – include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php to past file to

custom/include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php

Add following code before foreach loop which create input fields from $additionalFormFields.

if($relationship_name == ‘test_hello_opportunities’){

$additionalFormFields[‘test_hello_accounts_name’]=$defines[‘focus’]->account_name;

$additionalFormFields[‘test_hello_accountsaccounts_ida’]=$defines[‘focus’]->account_id;

}

It will work only for subpanel under opportunity module. It can not work for subpanel under Account module.

As Account module has one to many relationships with Opportunity.

November 16, 2017

0 responses on "Auto fill a relate field from parent to custom child module"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Have any questions?

    Send_mailsales@acalance.com

    +91 8123132883

    Acalance Logo

    About Us

    Acalance is a Training, Talent Management and Consulting Company with focus on Human Capital Development and Organizational Improvement.

    Our solutions are tailored for both Individuals and specific Organizations with suite approaches that have been proven effective. We help Organizations grow by defining and focusing on their core through High Impact Training, Strategies Development, Diagnosing and Eliminating Weak Processes and Optimize Performance.

    Certificate Code

    © 2019  Acalance. All rights reserved.
    Select your currency
    USD United States (US) dollar
    X