You need to sign in to do that
Don't have an account?
benfaust
Retrieving Additional Fields
I posted this question already, but after over a week no one has replied, so I'll rephrase it here. Surely we're not the only ones who have encountered this issue, and it's stalling any further progress.
We've been successfully retrieving a list of Lead and Contact results using PHP. We're querying the fields LastName, FirstName, Title, Street, City, State, PostalCode, Country, Phone, Email, and Id.
When we add ANY other field, whether it's a standard field such as Fax or Description, or a custom field, the contents of the [any] part of the object changes from a value to an array containing two items.
Before Any Additional Field:
stdClass Object
(
[done] => 1
[queryLocator] =>
[records] => Array
(
[0] => stdClass Object
(
[type] => Lead
[Id] => Array
(
[0] => 00Q3000000BK8qbEAD
[1] => 00Q3000000BK8qbEAD
)
(
[done] => 1
[queryLocator] =>
[records] => Array
(
[0] => stdClass Object
(
[type] => Lead
[Id] => Array
(
[0] => 00Q3000000BK8qbEAD
[1] => 00Q3000000BK8qbEAD
)
[any] => BenFaustna /naVT12345ben@eem.tv89723472
)
)
...
After Any Additional Field:
stdClass Object
(
[done] => 1
[queryLocator] =>
[records] => Array
(
[0] => stdClass Object
(
[type] => Lead
[Id] => Array
(
[0] => 00Q3000000BK8qbEAD
[1] => 00Q3000000BK8qbEAD
)
(
[done] => 1
[queryLocator] =>
[records] => Array
(
[0] => stdClass Object
(
[type] => Lead
[Id] => Array
(
[0] => 00Q3000000BK8qbEAD
[1] => 00Q3000000BK8qbEAD
)
)
...
I'm not sure if this answers you question, but you can get a much easier-to-use object from your query results by populating an SObject with them. My standard query code looks something like this:
Hope this helps.
Regards,
Charlie
The code for PHP5 is:
Code:
I experienced the same thing. I modified the function convertFields in SForcePartnerClient.php. This function is called by the SObject constructor function to parse the "any" string . The new code is pretty simple. Also, it causes no harm if $any is not an array.
Code:
On a closer look, it works but only part way. Here's the results:
[fields] => SimpleXMLElement Object
(
[FirstName] => Ben
[LastName] => Faust
[Street] => na /
[City] => na
[State] => VT
[PostalCode] => 12345
[Email] => ben@eem.tv
[Phone] => 89723472
[Company] => na
[MobilePhone] => SimpleXMLElement Object
(
)
[Fax] => SimpleXMLElement Object
(
)
[Description] => SimpleXMLElement Object
(
)
[NumberOfEmployees] => SimpleXMLElement Object
(
)
[SICCode__c] => SimpleXMLElement Object
(
)
[CurrentGenerators__c] => SimpleXMLElement Object
(
)
[emailid__c] => SimpleXMLElement Object
(
)
[Extra_Information__c] => SimpleXMLElement Object
(
)
)
Unfortunately, I don't yet know enough about XML objects to be able to extract whatever information is supposed to be inside them as usable data. Any ideas?
You need to "cast" the resulting data into specific "types" - (string), (float), (int). I am not sure why, but . . .
Try something like this -
$phone = (string) $contact->fields->phone;
Thanks again, that did the trick.
On an off-topic note, have you had any problems the last couple of days? The code we've been working on for this is in no way connected to our pages which provide administrative login to our system connected with Salesforce, or which submit information to Salesforce from the front end. However, yesterday and today we've been experiencing new errors in reponse to calls which, two days ago, worked perfectly. Does anyone know if the Salesforce system has been changing?
Message Edited by benfaust on 07-27-2006 07:58 AM
Bump...
This is a critical issues that has not yet been resolved, and I'm at wits end. The result of this "error" is that we cannot insert or upsert data into SF, and in effect, rendering our value proposition null and void.
What do we have to do on our end to elevate this to extreme? Pls advise!
Ben: would you please provide a more detailed explanation?
Joseph Rizzo
President/CEO
PluraPage/iNeoMarketing
Direct Line: 571.203.7081
Company Line: 703.453.9120
Cell: 703.244.8516
Fax: 703.453.9170
AOL IM: joemktg2
www.PluraPage.com
www.iNeoMarketing.com
Message Edited by jrizzo on 08-03-2006 11:26 AM