Answer the question
In order to leave comments, you need to log in
How to link a contact and a deal in Bitrix24 using the REST API?
Good afternoon, I'm new to PHP, tell me please, I add a contact and a deal, I take the data from the array that I received through the API, contacts are added, and deals too, how can I tie a contact with a deal?
// Функция добавления сделок
function addDeal($res) {
foreach($res['Items'] as $key => $value) {
$dealData = sendDataToBitrix('crm.deal.add', [
'fields' => [
'TITLE' => 'Заявка,
'STAGE_ID' => 'NEW',
'CONTACT_ID' => $value['Id'],
], 'params' => [
'REGISTER_SONET_EVENT' => 'Y'
]
]);
}
return $dealData;
}
// Функция добавления сделок
// Функция добавления контактов
function addContact($res) {
foreach($res['Items'] as $key => $value) {
$contactData = sendDataToBitrix('crm.contact.add', [
'fields' => [
'NAME' => $value['Data']['Name'],
'OPENED' => 'Y',
'PHONE' => ,
'EMAIL' => ,
'TYPE_ID' => 'CLIENT',
], 'params' => [
'REGISTER_SONET_EVENT' => 'Y'
]
]);
}
return $contactData['result'];
}
// Функция добавления контактов
Answer the question
In order to leave comments, you need to log in
How can I link to a deal?
There is also a performance problem, the array is very large and the script takes a long time to process, how can this be improved?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question