通过 REST 在 Bitrix 中填写自定义 CRM 字段 API

Fill custom CRM fields in Bitrix via REST API

我需要通过 REST 在 Bitrix24 CRM 中填写自定义字段 API。

在处理标准字段(如 TITLE、TEL 等)时它可以工作,但如果我尝试通过将自定义字段的 属性 名称放在请求中来确定自定义字段的价值,端点就会忽略它.

这里有一个片段:

$company = CRest::call(
    'crm.company.add',
    [
        'fields' => [
              "TITLE" => "Company 1"
            , "COMPANY_TYPE" => "Customer"
            , "CURRENCY_ID" => 'EUR'
            , "REVENUE" => "123000"
            , "ADDRESS" => "st. some address"
            , "ADDRESS_CITY" => "some city"
            , "ADDRESS_POSTAL_CODE" => "12345"
            , "ADDRESS_PROVINCE" => "some province"
            , "PHONE" => [
                         ["VALUE" => "1230000000", "VALUE_TYPE" => "WORK"]
                        ,["VALUE" => "1234000000", "VALUE_TYPE" => "FAX"]
                     ]
            , "EMAIL" => [ ["VALUE" => "me@company1.com", "VALUE_TYPE" => "WORK"] ]
            , "INDUSTRY" => "MANUFACTURING"
            , "CUSTOM_FIELD" => "Hey I'm not a standard field and I'm going to be ignored"
        ]
    ]
);

有没有人有同样的需求?我该如何解决?

我找到了解决方案。 只需填写字段 ID 而不是字段名称。字段 ID 类似于“UF_CRM_5AERER454DD4”。通过将其作为键和值放在“=>”之后,属性 得到了稳定。