You need to sign in to do that
Don't have an account?
Eric Santiago
Query error
I'm having trouble getting information from the parent (Account) of a custom object. The error is MALFORMED_QUERY: SOQL statements can't query related data. I've confirmed that I am using the PHP 1.1 toolkit and the 8.0 partner wsdl file. Any other suggestions?
Code:
Code:
<—php //include ('header.inc'); require_once ('../soapclient/SforcePartnerClient.php'); require_once ('../soapclient/SforceHeaderOptions.php'); session_start(); //login try { $mySforceConnection = new SforcePartnerClient(); $mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml"); $mylogin = $mySforceConnection->login("******", "*****"); $userResult = $mylogin->userInfo; echo $e->faultstring; echo "Error. Could not connect to Salesforce session."; exit; } $mySforceConnection; $myUserInfo; function getJobPosts($connection) { try { $query = 'SELECT Id, Title__c, Publish_Start__c, Employer__c, Employer__r.Name from Job_Posting__c Where Status__c = \'Published\' and Publish_Start__c <= ' .date('Y-m-d').' and Publish_End__c >= ' .date('Y-m-d').' ORDER BY Publish_Start__c DESC Limit 10'; $queryOptions = new QueryOptions(500); $response = $connection->query(($query), $queryOptions); return $response->records; }catch(Exception $e) { echo $e->faultstring; } } /** * Print out a list of the published job postings. * */ function displayRss() { global $mySforceConnection; //$result = $mySforceConnection->describeSObject("Account"); //print_r($result); $posts = getJobPosts($mySforceConnection); //print introduction paragraph print ('<–xml version="1.0"˜>'. "\r\n"); print ('<rss version="2.0">'. "\r\n"); print ('<channel>'. "\r\n"); print ('<title>Management Leadership for Tomorrow</title>'. "\r\n"); print ('<link>http://www.ml4t.org/</link>'. "\r\n"); print ('<description>Job opportunities exclusive to MLT.</description>'. "\r\n"); print ('<language>en-us</language>'. "\r\n"); print ('<pubDate>'.date('l dS \of F Y h:i:s A').'</pubDate>'. "\r\n"); print ('<lastBuildDate>'.date('l dS \of F Y h:i:s A').'</lastBuildDate>'. "\r\n"); print ('<docs>http://blogs.law.harvard.edu/tech/rss</docs>'. "\r\n"); print ('<generator>PHP</generator>'. "\r\n"); print ('<managingEditor>--@ml4t.org</managingEditor>'. "\r\n"); print ('<webMaster>--@ml4t.org</webMaster>'. "\r\n"); if ($posts) { //list published positions try { foreach ($posts as $r) { $r = new SObject($r); print ('<item>'. "\r\n"); print ('<title>'.$r->fields->Title__c.'</title>'. "\r\n"); print ('<link>http://www.ml4t.org/MLT_Network/JobPosting/SearchJobPostingDetails.aspx™Id='.$r->Id.'&EmpName=Warner%20Bros.%20Entertainment</link>'. "\r\n"); print ('<pubDate>'.$r->Publish_Start__c.'</pubDate>'. "\r\n"); print ('</item>'. "\r\n"); } } catch (Exception $e) { // Ignore Notices??? } } else { print ('<item><title>No positions available at this time.</title><link>#</link><pubdate></pubdate></item>'); } print ('</channel></rss>'. "\r\n"); } displayRss(); ?>
Message Edited by Eric Santiago on 08-10-2007 01:54 PM
Now that the query works I'm a bit confused as how to reference the field in my output. Using the code below doesn't return the actual account name as expected. I suspect it has something to do with the dot notation but I'm not sure what the syntax should be. Any suggestions?
Code:
Needed to use
Code: