• technoparkcorp
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have a Custom Object and I want to relate it to Lead AND Opportunity. The same way as Task is related to them.

Can I do this?

And if I can't, the question is - how shall be managed the link from my Object to Lead, when the Lead is converted to Opportunity. What will happen with the link?

Thanks.

ps. Any suggestions?


Message Edited by technoparkcorp on 07-03-2008 06:52 AM
Hello Everybody,

I'm pretty new to the API and I am having a problem with creating a lead.  It gives me the error of Required Fields Missing. Below the code, I'll paste in the responses I get. I've also pasted in the arrays and sobject to view although I took the print_r()'s out of the code below.

FYI: I don't want to use the web-to-lead because my next step is to add more functionality when capturing a lead. I thought I'd first start with getting a lead into the system first.


Here is my code (which is pretty much from one of the samples just changed to creating a lead vs. account:

Code ( I took out the login portion):
$fields = array (

'LastName' => $_POST['last_name'],
'Company' => $_POST['company'],
'Salutation' => $_POST['salutation'],
'FirstName' => $_POST['first_name'],
'Title' => $_POST['title'],
'Phone' => $_POST['phone'],
'Email' => $_POST['email'],
'LeadSource' => $_POST['lead_source']
);

$sObject = new SObject();
$sObject->type = 'Lead';
$sObject->fields = $fields;

echo "**** Creating the following:\r\n";
$createResponse = $mySforceConnection->create($sObject);
session_write_close();

} catch (Exception $e) {
echo $mySforceConnection->getLastRequest();
echo $e->faultstring;
}

 Responses:
This is the fields array
Array
(
[LastName] => Last123123
[Company] => testing
[Salutation] =>
[FirstName] => First123
[Title] => test
[Phone] => 949-555-1212
[Email] => test@tetst.com
[LeadSource] => Website
)

This is the sObject
SObject Object
(
[type] => Lead
[fields] => Array
(
[LastName] => Last123123
[Company] => testing
[Salutation] =>
[FirstName] => First123
[Title] => test
[Phone] => 949-555-1212
[Email] => test@tetst.com
[LeadSource] => Website
)

)
**** Creating the following:
stdClass Object
(
[errors] => stdClass Object
(
[fields] => Array
(
[0] => LastName
[1] => Company
)

[message] => Required fields are missing: [LastName, Company]
[statusCode] => REQUIRED_FIELD_MISSING
)

[id] =>
[success] =>
)

As you can see, the sObject Array has the fields in it. So I don't know how to solve this problem. Any help would be greatly appreciated.

Thanks,

Chris