A
A
alexander_chn2018-12-08 00:12:42
API
alexander_chn, 2018-12-08 00:12:42

How to enter a value in AMOCRM via API in a custom Multilist field?

Hello! The essence of the question is in the title. There is a custom field, it looks like this:
5c0ae1bb6255c152327319.png
On the site, these items are presented as checkboxes, on the server side I accept them, and I get a list of checked fields. How can I add them to amo crm?
Here is the code for adding entries to this multilist:

require_once __DIR__ . '/amocrm.phar';
try {
  $amo = new \AmoCRM\Client('profit1', '[email protected]', '3cea6f59960a5ba7d4fe47f4a188c98b');
  $lead = $amo->lead;
  $lead['name'] = $name;
  $lead['responsible_user_id'] = 1659931;

  $lead->addCustomField(412109, );
  $lead_id = $lead->apiAdd();

  $contact = $amo->contact;
  $contact['name'] = $name;
  $contact['linked_leads_id'] = $lead_id;
  $contact['responsible_user_id'] = 1659931;
  $contact->addCustomField(396157, );
  $id = $contact->apiAdd();

  echo "Good";
} catch (\AmoCRM\Exception $e) {
  printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}

Thanks in advance for the tips!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question