Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

MP_Addon_Salesforce::add_lead_data_to_salesforce( array $data, string|int $lead )

Add lead data to Salesforce.


Parameters Parameters

$data

(array) (Required) $lead_data { Lead data. @type string 'FirstName' lead first name @type string 'LastName' lead last name (required) @type string 'Company' company (required) @type string 'Phone' lead phone @type string 'Email' lead email }

$lead

(string|int) (Required) lead id


Top ↑

Source Source

File: calculator-salesforce-add-on/inc/MP_Addon_Salesforce.php

	private function add_lead_data_to_salesforce($data, $lead) {

		$check_data = array(
			'email' =>  $data['Email'],
			'name'      =>  $data['FirstName']. ' '.$data['LastName']
		);
		$check = $this->is_client($check_data);

		if (!empty($check)){
			foreach ($check as $id){
				$update = $this->update_data($data, $id);
				if (empty($update[0]) && 204 == $update[1]){
					$response = array(
						'success'=>'updated',
						'id' => $id,
						'0' => array(
							'message' => '',
							'errorCode' => ''
						)
					);
					$this->set_logs($response, $lead);
				} else {
					$this->set_logs($update[0], $lead);
				}
			}
		} else {
			$insert = $this->insert_data($data);
			$this->set_logs($insert, $lead);
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.