Answer the question
In order to leave comments, you need to log in
How to pull a custom field from an account into a deal?
It is necessary in the deal business process , through the php code , to get the value of the custom field from the account associated with the deal . Then write this value in the deal field? Actually, how can I get the account id , and how can I then pull out the value? This is necessary because there is a partial payment, and through the value of the payment received, you need to calculate the salary.
Answer the question
In order to leave comments, you need to log in
Use the list method GetList() .
$arOrder = ["ID" => "DESC"]; // сортировка
$arFilter = ["UF_DEAL_ID" => $dealId]; // фильтрация по ID сделки
$arSelect = ["ID", "UF_DEAL_ID"]; // какие поля выбрать
$invoices = CCrmInvoice::GetList($arOrder, $arFilter, false, false, $arSelect);
while($invoice = $invoices->Fetch()) {
// ваш код
}
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\Web\Json
$client = new HttpClient;
$webhook = "https://webhook_url/crm.invoice.list";
$params = [
"filter" => $arFilter,
"order" => $arOrder
];
$request = $client->post($webhook, Json::encode($params));
$result = Json::decode($request);
foreach($result["result"] as $res) {
// ваш код
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question