mesilov / bitrix24-php-sdk

A powerful PHP library for the Bitrix24 REST API
MIT License
409 stars 161 forks source link

Certain fields doesn't insert #59

Closed vankaiser closed 6 years ago

vankaiser commented 8 years ago

Hi, crm.lead.add doesn't allow me to insert phone, email, and IM, but other info are Ok.

goodok21 commented 7 years ago

IM - array

private function createContact($inputData)
{
    $addData = array();
    $addData['NAME'] = $inputData['NAME'];
    $addData['SECOND_NAME'] = $inputData['SECOND_NAME'];
    $addData['LAST_NAME'] = $inputData['LAST_NAME'];
    $addData['IM'] = array($inputData['IM']);
    $params = array();

    $contact = new Contact($this->bx24);

    $result = $contact->add($addData, $params);

    if(empty($result['result'])) {
        throw new \RuntimeException("Failed to contact create");
        print_r('error: '.$result);
    }

    $contactId = $result['result'];

    return $contactId;
}
ronalddas commented 6 years ago

@vankaiser I am trying to use the crm.lead.add, am always getting the error The required field 'Lead Name' is missing.<br />. I Checked necessary fields using the crm.lead.fields, and only "TITLE" has isRequired:True, even if i include TITLE, am getting the same error. Did you face this bug?

This is my function in python ' def lead_add(id,phone=None): try: auth_code = get_auth_code() payload = {"auth": str(auth_code),"TITLE":str(id)} url=hit_url+'crm.lead.add' res=requests.get(url,params=payload) print(res.url) return res.json() except Exception as ex: print("EXCEPTION", ex) '

This is the request url https://one.bitrix24.com/rest/crm.lead.add?TITLE=ROnald&auth=2v9g9a55vxeestrfgftyse

vankaiser commented 6 years ago

Have you tried to pass the name param as empty string? Name might be required.