hi,
I have created a Custom field ’ Credit On Hold’, in Accounts module, howto reflect its value to ‘Accounts’ related records of Quote, Invoice and opportunity. modules.
When a user modifies the ‘Credit On Hold’, its value should be displayed in Quote, Invoice and Opportunity.
What is the best approach to achieve above requirement.
You can do this from “after_retrieve” and “process_record” logic look.
For Detail View use the after_retrieve.
For Subpanel View and list view you can use the process_record logic hook.
Steps to Follow:-
Create an “after_retrieve” hook to pull the target field data on the detail view.
Create a non-db field in module B and put above field value inside this field.
Drag and drop your field in detailView.
If you are looking to show this field value inside list view/pop up or sub panel, you need to create a “process_record”. just call the same class and function.
i would do this by extending vardefs / creating a related field in Contacts / Invoices / Opportunities.
Look at the vardefs how account_name is related, copy the definition and change the id i.e Account_CreditonHold.
Then you can use it in List/Edit/Detail Views and subpanel.
the issue is that account ‘credit_hold_c’ dose not reflect on contact module and in contact edit view give option to select account instant of 'checkbox;.
<?php
#if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/Opportunities/Opportunities.php');
class creditonhold3
{
protected static $fetchedRow = array();
public function GetValue($Bean, $event, $arguments)
{
$o=new Opportunity();
$o->retrieve($Bean->opportunity_id); //check but I believe that's the account id relate field in the case
$a = new Account();
$a->retrieve($o->account_id_c)
$field_one_value = $a->credit_hold_c;
$Bean->credit_hold_c = $field_one_value;
$GLOBALS['log']->fatal("fareed:GetValue::Opp".$Bean->name);
$GLOBALS['log']->fatal("fareed:GetValue::ACC".$a->name);
$GLOBALS['log']->fatal("fareed:GetValue::CreditOnHold".$field_one_value);
}
public function ShowLog($Bean, $event, $arguments){
$GLOBALS['log']->fatal("fareed::");
}
}
?>