I have the need to fill custom fields in Bitrix24 CRM via REST API.
When it comes to working on standard fields (like TITLE, TEL, etc) it works, but if I try to valorize a custom field by putting it’s property name in the request the endpoint simply ignores it.
Here you have a snippet:
$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" ] ] );
Did anyone have the same need? How can I solve it?
Advertisement
Answer
I found the solution. Simply write the Field ID instead of the Field Name. The Field ID looks like “UF_CRM_5AERER454DD4″. By putting this as key and the value after ” => ” the property gets valorized.