Calculated Fields

I’m working with the latest version of SuiteCRM and I’m trying to create a calculated field to get the value of a Contacts and Accounts Quotes YTM and YTD.

Selecting either Accounts or Contacts as the WorkFlow Module will not pull up the Quote module in relation parameters. I doesn’t pull up hardly any choices.

I this correct or I am doing something incorrect here?

I noticed the same issue also in an older version.
For me it’s a bug but I am not sure: this may be wanted or, if other reletionships are used some problems may occur!

hi did you manage to solve this

Hi,
I believe the calculated fields don’t use many-to-many relationships in general.

Hello,
why don’t you use some logic hooks instead? Code is simple:


public function calcValue(&$bean, $event, $arguments){
        $value = (float)0;
        $oppList = $bean->get_linked_beans('opportunities','Opportunitites');
        foreach($oppList as $opportunity){
                $value += $opportunity->amount;
        }
        $bean->description = "Value is " . $value;
    }
  • I tested it as a before_save-hook (but in retrospect it would make more sense to add it as after_relationship_add-event).
  • you can filter the opportunity list within the get_bean_list method or by adding an if-statement within the foreach