@IgorPlays

Как добавить сделку с примечанием?

Пытался сделать как в примерочном файле результата ноль..
Вот код>
if($comment != null && $comment != ''){
        $notesCollection = new NotesCollection();
        $serviceMessageNote = new ServiceMessageNote();
        $serviceMessageNote->setEntityId(1)
            ->setText($comment)
            ->setService('Api Library')
            ->setCreatedBy(0);

        $notesCollection->add($serviceMessageNote);

        try {
            $leadNotesService = $apiClient->notes(EntityTypesInterface::LEADS);
            $notesCollection = $leadNotesService->add($notesCollection);
        } catch (AmoCRMApiException $e) {
            echo "Error";
        }
    }


$comment - не пустой.. Где ошибка? лид приходит а примечания нету
  • Вопрос задан
  • 75 просмотров
Решения вопроса 1
@IgorPlays Автор вопроса
$notesCollection = new NotesCollection();
    $commonNote = new CommonNote();
    $commonNote->setEntityId($addedLead->getId())
        ->setCreatedBy(0)
        ->setText($comment);
    $notesCollection->add($commonNote);

    try {
        $leadNotesService = $apiClient->notes(EntityTypesInterface::LEADS);
        $notesCollection = $leadNotesService->add($notesCollection);
    } catch (AmoCRMApiException $e) {
        echo "Error";
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы