简要描述:

  • 获取模块自定义字段

请求URL:

  • /api/v2/custom_fields/:entity_type/by_group

  • url请求参数说明
字段名 是否必填 描述
entity_type true 实体名(customer,contact,contract,lead,opportunity,product)
custom_field_template_id false 自定义业务类型id, 调用接口 业务模版接口获取id
  • 实体名(:entity_type)参数说明:
参数名 描述
lead 线索
customer 客户
contact 联系人
opportunity 商机
contract 合同
received_payment 回款
product 产品

请求方式:

  • GET

请求参数:

返回值说明

custom_field_groups: 自定义字段区块

字段 类型 说明
id number 区块ID
label string 区块标签
custom_fields array(object) 区块下自定义字段列表

custom_fields

字段 类型 说明
id number 自定义字段ID
label string 自定义字段标签
name string 自定义字段名称。可以作为存到数据库/编程/接口调用时的字段名(key)。
field_type string 对自定义字段类型的描述。

返回示例:

正确时返回:


{
  "code": 0,
  "data": {
    "custom_field_groups": [
      {
        "id": 9,
        "label": "基本信息",
        "position": 1,
        "status": "enable",
        "custom_field_setting_id": 3,
        "custom_fields": [
          {
            "id": 51,
            "name": "customer",
            "label": "对应客户", # 标签
            "field_type": "select2_field", # select
            "category": "common", #类型
            "position": 2, #位置
            "label_html_options": {},
            "custom_column_name": "customer.name", # 列名
            "input_field_options": {}, # 选项
            "status": "enable", #是否可用
            "required": true, #是否必填
            "cannot_edit": false # 为true则不能编辑
          },
          {
                        "id": 159699097,
                        "name": "text_asset_fbf817",
                        "label": "单位名称",
                        "field_type": "text_field",
                        "category": "common",
                        "position": 2,
                        "placeholder": "请输入公司简称",
                        "label_html_options": {},
                        "custom_column_name": "text_asset_fbf817",
                        "input_field_options": {},
                        "status": "enable",
                        "required": false,
                        "cannot_edit": false,
                        "cannot_add": false,
                        "cannot_see": false,
                        "custom_field_setting_id": 624599,
                        "custom_field_group_id": 1839380,
                        "is_user_custom_column": true,
                        "required_readonly": false,
                        "category_readonly": false,
                        "status_readonly": false,
                        "base_columns_readonly": true,
                        "field_type_option": "text_field",
                        "origin_field_type": "",
                        "is_related_custom": false,
                        "exclude_place": [],
                        "options": {
                            "custom_column_name": "text_asset_fbf817"
                        }
                    },
        ]
      }
    ]
  }
}

错误时返回:


{
  "code": 100401,
  "data": null,
  "message": "你的帐号已在其他地方登录,本地已经下线"
}

返回参数说明:

暂无

自定义字段使用说明

  • 自定义字段的 name 可以作为参数的key使用。例如:
   var customerPostData = {
      "name": "客户名",
      "text_asset_fbf817": "自定义文本字段"
   };
   saveToCustomerWithApi(customerPostData);

备注:

文档更新时间: 2025-04-29 14:18   作者:陈胜海