如何使用suitCRM或sugarCRM中的帐户关系字段更改或更新联系人模块中的姓名、电子邮件和电话号码?

问题描述 投票:0回答:1

在联系人模块中,我添加了帐户的关系字段。现在我希望当我使用帐户字段并从列表中选择一个帐户时,联系人模块的姓名、电子邮件和电话号码字段将填写该帐户的姓名、电子邮件和电话号码,我将使用该帐户进行选择关系帐户字段。 我该怎么做,请定义代码以及我必须在其中添加定义代码才能执行此任务的目录。

我通过互联网搜索尝试了逻辑钩子,在我的custom/module/contacts/populated fields.php目录中,这是代码,但它根本不起作用。

`<?php
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not a valid entry point.');
}
class PopulateFields
{
    function populate($bean, $event, $arguments)
    {
        // Check if the Account field has changed
        if ($bean->account_id != $bean->fetched_row['account_id']) {
            // Retrieve the selected Account's information
            $accountBean = BeanFactory::getBean('Accounts', $bean->account_id)     
            // Populate the fields with the Account's information
            if (!empty($accountBean)) {
                $bean->name = $accountBean->name;
                $bean->email1 = $accountBean->email1;
              $bean->phone_office = $accountBean->phone_mobile;
            }
        }
    }
}
`
crm sugarcrm suitecrm
1个回答
0
投票

如果您想在记录视图本身上填写这些信息,那么您可能需要在前端编写自定义逻辑(record.js)

检查糖食谱 - https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Cookbook

并且,如果您同意在单击记录视图上的保存按钮后填充它,那么(before_save)逻辑挂钩将是最好的方法。

https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_save/

希望有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.