Y
Y
Yastr2014-07-22 23:24:07
PHP
Yastr, 2014-07-22 23:24:07

How to add custom field value when creating a lead via SalesForce api?

Hello!
I add a lead through the api, everything works fine, but there was a need to include a custom field in it, I created it in the admin panel, got the id - "00N20000008cfNz_ileinner" (I found out through the source code, I couldn't find anything similar anywhere else).
I'm trying to add the same as a regular field - $lead->"00N20000008cfNz_ileinner" = "yandex.ru";
but nothing comes out, please tell me how to solve this problem.

<?php

define("USERNAME", "name");
define("PASSWORD", "pass");
define("SECURITY_TOKEN", "token");
require_once ('soapclient/SforceEnterpriseClient.php');

$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection->createConnection("enterprise.wsdl.xml");
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);

$lead->type = 'Lead';
$lead = new stdclass();
$lead->FirstName = "CC3CCC";
$lead->LastName = "Ястр";
$lead->Company = "ЯстрКом";
$lead->Email = "[email protected]";

// пользовательское поле с id 00N20000008cfNz_ileinner
// $lead->"00N20000008cfNz_ileinner" = "yandex.ru";

$result = $mySforceConnection->create(array($lead), 'Lead');
print_r($result);

?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Isakov, 2014-07-23
@Yastr

Try not the field ID but its name, something like customfield__c

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question