You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Business Central API 2.0获取Customer Price Group

在Business Central中获取客户价格组的方法

1. 通过API获取

  • 获取单个客户的关联价格组:调用customers实体接口,指定客户ID后,返回结果中的priceGroupCode字段即为该客户的价格组编码。示例请求:
    GET /companies({companyId})/customers({customerId})?$select=priceGroupCode
    
  • 获取系统中所有客户价格组:直接调用customerPriceGroups实体接口,可返回所有已配置的价格组完整信息(编码、名称等):
    GET /companies({companyId})/customerPriceGroups
    

2. 客户端操作查看

  • 查看单个客户的价格组:打开客户列表,选中目标客户进入客户卡片,在销售&收款标签页下找到「价格组」字段。
  • 查看所有价格组定义:在系统搜索栏输入「客户价格组」,打开对应页面即可查看所有已创建的价格组。

3. AL开发方式获取

如果需要在自定义功能中读取价格组数据,可使用以下AL代码:

  • 获取单个客户的价格组:
    var
        Customer: Record Customer;
        PriceGroupCode: Code[20];
    begin
        if Customer.Get('CUST001') then begin // 替换为实际客户ID
            PriceGroupCode := Customer."Price Group Code";
            Message('客户价格组:%1', PriceGroupCode);
        end;
    end;
    
  • 遍历所有客户价格组:
    var
        CustomerPriceGroup: Record "Customer Price Group";
    begin
        if CustomerPriceGroup.FindSet() then begin
            repeat
                Message('价格组编码:%1,名称:%2', CustomerPriceGroup.Code, CustomerPriceGroup.Name);
            until CustomerPriceGroup.Next() = 0;
        end;
    end;
    

内容的提问来源于stack exchange,提问作者A. Seierup

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 20:22:04