选择相关字段时填充字段_套件 crm [英] Populating a field when choosing a relate field _ suite crm

查看:23
本文介绍了选择相关字段时填充字段_套件 crm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用套件 crm 7.7.5

i'm using suite crm 7.7.5

当我创建机会并从相关字段中选择一个帐户时,我希望使用所选帐户所在国家/地区的值自动填充一个字段(国家/地区).

when i create an opportunity and i choose an account from a relate field, i want a field (country) to be auto populated with the value of the country of the account chosen.

为此,我尝试添加代码

    $dictionary['Opportunity']['fields']['country_c']['populate_list']= array('id','name','country_c');
$dictionary['Opportunity']['fields']['country_c']['field_list'] = array('account_id_c','account_name','country_c');

在文件\custom\Extension\modules\Opportunities\Ext\Vardefs\sugarfield_country_c.php

in the file \custom\Extension\modules\Opportunities\Ext\Vardefs\sugarfield_country_c.php

知道country_c是表accounts中列country的名称,第二个country_c是布局机会中字段country的id

knowing that country_c is the name of the column country in the table accounts and the second country_c is the id of the field country in the layout opportunity

但这不起作用,有人能帮我找出原因吗?

but that doesn't work, could someone help me to figure out the reason?

PS:我尝试按照本教程https://developer.sugarcrm.com/2011/08/31/howto-using-a-relate-field-to-populate-a-custom-field/

PS : i've tried to follow this tutorial https://developer.sugarcrm.com/2011/08/31/howto-using-a-relate-field-to-populate-a-custom-field/

推荐答案

你应该去 custom/modules/{YOUR MODULE}/metadata/editviewdefs.php 并编辑 editviewdefs.php 文件.
首先你需要找到定义了相关字段(account_name)的数组.它看起来与此类似,也许还有更多参数.

You should go to custom/modules/{YOUR MODULE}/metadata/editviewdefs.php and edit editviewdefs.php file.
First you need to find array in which your relate field(account_name) is defined. It will look similar to this, maybe with some more parameters.

array (
    'name' => 'account_name',
),

现在您需要将数据从相关字段(country_c)映射到新字段(假设为populated_country_c).编辑后,您的数组将如下所示.

Now you need to map data from relate field(country_c) to new field(lets say populated_country_c). After editing your array will look something like this.

array (
    'name' => 'account_name',
    'displayParams' => array (
        'field_to_name_array' => array(
            'id'=>'account_id_c',
            'name'=>'account_name',
            'country_c' => 'populated_country_c',
            ),
        ),
    ),

现在 populated_country_c 是新字段,当您在相关字段中选择帐户时,将在其中填充有关国家/地区的数据.所以我们还需要创建那个新字段.您可以通过工作室或手动添加新数组来完成.最后,您的文件将如下所示

Now populated_country_c is the new field in which the data about country will be populated when you choose account in the relate field. So we also need to create that new field. You can do it through studio or manually just by adding new array. Finally your file will look like this

array (
        'name' => 'account_name',
        'displayParams' => array (
            'field_to_name_array' => array(
                'id'=>'account_id_c',
                'name'=>'account_name',
                'country_c' => 'populated_country_c',
                ),
            ),
        ),
array (
        'name' => 'populated_country_c',
        'label'=> 'LBL_POPULATED_COUNTRY'
        ),

现在,当从相关字段中选择新帐户时,populated_country_c 将填充所选帐户中的 country_c 字段.

Now when choosing new account from relate field, populated_country_c will be populated with country_c field from selected account.

这篇关于选择相关字段时填充字段_套件 crm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆