如何通过manifest.php添加依赖的自定义字段

时间:2015-04-17 13:00:50

标签: sugarcrm

我目前正在添加一个Web钩子,并希望通过manifest.php以编程方式添加一些字段。

我找到了添加字段的相关信息,如下所示:

'custom_fields' => array (
array (
    'name' => 'text_c',
    'label' => 'LBL_TEXT_C',
    'type' => 'varchar',
    'max_size' => 255,
    'require_option' => 'optional',
    'default_value' => '',
    'ext1' => '',
    'ext2' => '',
    'ext3' => '',
    'audited' => 1,
    'module' => 'Accounts'
    )
);

问题是我似乎无法找到如何使字段依赖,即只有在另一个字段包含特定值时它们才会可见。

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:1)

在定义数组中,您需要添加依赖项属性,如下所示:

'custom_fields' => array (
array (
    'name' => 'text_c',
    'label' => 'LBL_TEXT_C',
    'type' => 'varchar',
    'max_size' => 255,
    'require_option' => 'optional',
    'default_value' => '',
    'ext1' => '',
    'ext2' => '',
    'ext3' => '',
    'audited' => 1,
    'module' => 'Accounts'
    'dependency' => 'equal($other_field,"other field value")'
    )
);

这将复制在Studio中设置依赖项选项。

依赖公式

'equal($other_field,"other field value")'

当另一个字段 other_field 等于字符串"其他字段值"

时,均值显示此字段
相关问题