D
D
Doctor_Dalek2019-09-19 13:02:15
1C-Bitrix
Doctor_Dalek, 2019-09-19 13:02:15

Creating a lead from an infoblock in Bitrix24?

Hello! Please help a newbie in Bitrix.
The goal is to create site integration on the 1C Bitrix platform Site management and Bitrix24 crm. And everything seems to be successful, leads are created, but the specified fields are not added. It turns out that if a lead with the "NAME" field was already created in crm, then everything is fine, the name is transferred from the site, but the rest of the information is not.

$queryData = http_build_query(array(
      'fields' => array(
              "LOGIN" => $login, 
  "PASSWORD" => $password, 
        "TITLE" => 'Лид с сайта',
        
             "NAME" => $name,
              "SECOND_NAME" => $phone,
              "LAST_NAME" => $special,
              
        "COMMENTS" => "Лид создан автоматически с сайта ",
      ),
      'params' => array("REGISTER_SONET_EVENT" => "Y"),
    ));

    
    $rest = 'crm.lead.add.json';
    
    $queryUrl = 'тут код вебхука';
    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_SSL_VERIFYPEER => 0,
      CURLOPT_POST => 1,
      CURLOPT_HEADER => 0,
      CURLOPT_RETURNTRANSFER => 1,
      CURLOPT_URL => $queryUrl,
      CURLOPT_POSTFIELDS => $queryData,
    ));
    $result = curl_exec($curl);
    curl_close($curl);
    $result = json_decode($result, 1);
    if (array_key_exists('error', $result))
    {
      echo "Ошибка при сохранении лида: ".$result['error_description']."";
    }
    else
    {
      return $result['result'];
    }
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-09-23
Madzhugin @Suntechnic

Unclear. Do you want a lead to automatically create new fields when a lead is added? It doesn't work like that.
All fields that you want to transfer must be created in advance.
Well, it's like wanting an INSERT to create columns in a table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question