Obama '08

               
   

Go Back   Mike Simonds > Salesforce > Salesforce Coding Discussions

This is a discussion on update, queryMore problems within the Salesforce Coding Discussions forums, part of the Salesforce category; Look, as far as I'm concerned, Salesforce shouldn't offer the PHP toolkit

Reply
 
LinkBack Thread Tools Rate Thread
  #1  
Old 11-13-2007, 04:49 AM
Junior Member
 
Join Date: Nov 2007
Posts: 5
Send a message via Skype™ to murraybiscuit
Angry update, queryMore problems

Look, as far as I'm concerned, Salesforce shouldn't offer the PHP toolkit if they don't have an API with PHP code. It's wasted a lot of my time...

- Using a developer account
- disbled wsdl caching
- using the partner wsdl
  1. queryMore - i have followed all examples, tried different angles:
    • after the initial query(), "done" returns true and "queryLocator" has no value.
    • i can set "done" to false in order to start a loop for queryMore, but queryLocator still has no value and so the function returns an error.
  2. update - i construct an SObject and send it off, get success=1, but the record in salesforce stays the same. I suspect it may have something to do with the way I have constructed the fields in the SObject, but I can't see anything inconsistent with other examples or with what the soapclient functions require.
Please help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2  
Old 11-13-2007, 07:27 AM
Administrator
 
Join Date: May 2007
Posts: 246
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

Quote:
Originally Posted by murraybiscuit View Post
Look, as far as I'm concerned, Salesforce shouldn't offer the PHP toolkit if they don't have an API with PHP code. It's wasted a lot of my time...

- Using a developer account
- disbled wsdl caching
- using the partner wsdl
  1. queryMore - i have followed all examples, tried different angles:
    • after the initial query(), "done" returns true and "queryLocator" has no value.
    • i can set "done" to false in order to start a loop for queryMore, but queryLocator still has no value and so the function returns an error.
  2. update - i construct an SObject and send it off, get success=1, but the record in salesforce stays the same. I suspect it may have something to do with the way I have constructed the fields in the SObject, but I can't see anything inconsistent with other examples or with what the soapclient functions require.
Please help

Post some of your code and I will try and help you out. While I agree with your statement, there are some examples on the developer network and here that work right out of the box, but again let me check out your code and I can try and point you in the right direction for both the upsert and the extract of records from Salesforce using PHP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 11-13-2007, 03:30 PM
Junior Member
 
Join Date: Nov 2007
Posts: 5
Send a message via Skype™ to murraybiscuit
code samples

Thanks for a speedy response, update() code:

PHP Code:
$sObject=new sObject();
  
$sObject->type='Contact';  
  
$sObject->Id='id reference here';
//updating the password, a custom field on the contact object
  
$sObject->fields["Password__c"]=$_POST['newpass'];
 
$sObject->fields["Description"]="testing";
 
//print_r ($sObject);
 
$result=$mySforceConnection->update($sObject);
 
//print_r($result);
 
if($result->success){
  
$onload.="alert('Thanks. Password updated');";
 }else{
  
$onload.="alert('".$result->errors[0]->message."');";
 } 
In terms of the queryMore code, I've come up with a workaround:
Basically when I get each row of the select result, i check for $result->records[$i]->sobjects, which gives me the nested sobjects and i proceed to add those to a holding array, which I then iterate through to build an html table.

Excuse my ignorance, but where is the API reference which has the php examples in it? Your posts there seem the most helpful. Well done.

Take the following code sample excerpt from Creating Email Reports in PHP - ApexDevNet ("working with results" section):

PHP Code:
$_id CampaignMember->sobjects[0]->Id;
$_name $CampaignMember->sobjects[0]->fields->Name;
$_email CampaignMember->sobjects[0]->fields->Email;
$_title CampaignMember->sobjects[0]->fields->Title
Surely lines 1,3 and 4 won't work here, as the object name should be $CampaignMember, not CampaignMember?

Anyway, any help would be appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 11-14-2007, 08:15 AM
Administrator
 
Join Date: May 2007
Posts: 246
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

Hey MB I just wanted to acknowledge your post and that I will review your questions and try and get back to you today but it may be tomorrow before I can!

~Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 11-18-2007, 03:53 PM
Junior Member
 
Join Date: Nov 2007
Posts: 5
Send a message via Skype™ to murraybiscuit
Thumbs up fixed

I seem to have solved this: the update() function requires an array of objects as the argument, even if you just have one object to update, add it to an array. In my opinion, the function should check to see if the value it is receiving is an array or not and return an error before it carries on with the rest of the function. I can't see how I received a successful return from this function when it never worked and the argument supplied in the first place was wrong.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 11-19-2007, 08:34 AM
Administrator
 
Join Date: May 2007
Posts: 246
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

MB

Sorry that I did not get a chance to look into this for you and I am glad that you were able to figure it out. I actually could have told you that even if you were updating one item that it had to be an array. I do agree that the function should check to see if the the value it is receiving is an array:

PHP Code:
 if is_array($value)
{
   do 
this
}
else
{
   echo 
"Your data needs to be in an array, please check data and correct";

Maybe something like that can be added to your script to check it or maybe you can send that to Nick Tran and he can add it to the next release (whenever that is)

Do you still need help on the other issue?

Again sorry for my lack of looking into this

~Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



Powered by vBulletin


SEO by vBSEO 3.2.0 RC8 ©2008, Crawlability, Inc.

1 2 3 4 5