crm查询接口默认返回所有字段的值,可以通过对crm中 D:\ldcrm\www\crm\user_privileges\apiFieldConfig.php 文件的配置来指定需要返回的字段值
根据crm模块是否有分录,是否产品分录区分需要配置的格式:
(注:设置的字段中只有启用的字段会被返回)
1、crm模块没有分录(以产品模块为例,客户和供应商模块比较特殊在文档最后)
static $Products_List = array(
'productid' => 'productid', //产品id
'productname' => 'name', //产品名称
'product_no' => 'product_no', //产品编号
'usageunit' => 'usageunit', //计量单位
'cf_4478' => 'cf_4478' //自定字段
);
a、数组名:客户模块数组名为:Account_List,其他模块的数组名都是:模块名_List
b、数组键(左边部分)是灵当CRM系统中的字段,数组值(右边部分)是调用API接口时URL中返回的参数名
c、CRM系统中的字段可以在ld_field表中查询,数组键对应ld_field表fieldname列:
select * from ld_field where tabid=(select tabid from ld_tab where `name`='Products') and presence<>1 order by block,sequence;
效果展示:
2、包含产品分录的模块(例:销售订单模块):
static $SalesOrder_List = array(
'SalesOrder' => array(
'salesorderid' => 'salesorderid', //合同订单id
'salesorder_no' => 'number', //合同订单编号
'subject' => 'subject', //主题
'modifiedtime' => 'modifiedtime', //修改时间
'description' => 'description' //合同订单备注
),
'Products' => array(
'product_no'=>'product_noproduct_no', //如果这里设置了无法返回,需要查看crm分录了字段是否开启
'productid' => 'productid', //产品id
'productname' => 'productname', //产品名称
'description' => 'description' //产品备注
)
);
'Products' => array():产品分录返回字段,如果不需要返回分录字段,可以不设置这部分
3、 非产品分录(例:收款单模块):
static $CashBill_List = array(
'CashBill' => array(
'cashbillid' => 'cashbillid',
'cashbill_no' => 'cashbill_no',
'assigned_user_id' => 'assigned_user_id',
'currency_id' => 'currency_id',
'cf_7879' => 'cf_7879'
),
'TabDetails' => array(
'entitytype'=>'entitytype', //如果这里设置了无法返回,需要查看crm分录了字段是否开启
'billdate' => 'billdate', //产品id
'source_total' => 'source_total', //产品名称
'plan_amount' => 'plan_amount', //产品备注
'product_no' => 'product_no' //产品备注
)
);
'TabDetails' => array():非产品分录的分录字段
4、特殊模块(例:客户模块,客户模块查询会显示关联的联系人信息)
static $Account_List = array(
'Accounts' => array(
'accountid' => 'accountid', //客户id
'accountname' => 'companyname', //客户名称
'rating'=>'accountstatus', //客户状态
'accounttype'=>'accounttype', //客户状态
'modifiedtime' => 'updateTime', //修改时间
'bill_street'=>'companyaddress',
'description' => 'description' , //备注
),
'Contacts' => array(
'account_id' => 'account_id',
'contactid' => 'cid', //联系人ID
'lastname' => 'crealname', //联系人姓名
'mobile' => 'cmobile', //联系人手机
'description' => 'cremark',
)
);
'Accounts' => array():客户模块的需要返回的字段
'Contacts' => array():联系人模块字段,显示客户关联的联系人信息(供应商不返回联系人信息,可以不加这部分)