function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
peterpptpeterppt 

Displaying custom fields in php page using php toolkit

I am using the following code to display records from the Event Table.

<?php

define("USERNAME", "xxxx");
define("PASSWORD", "yyyy");
define("SECURITY_TOKEN", "zzz");



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




$query = "SELECT Subject,Description,EndDateTime,StartDateTime,OwnerID,Public_Name__c,Web_Publish__c  from Event WHERE Web_Publish__c = TRUE";
$response = $mySforceConnection->query($query);
?>
<table id="customers">
<tr>
  <th>Subject</th>
  <th>Description</th>
  <th>End</th>
  <th>Start</th>
  <th>Owner</th>
  <th>Location</th>
  <th>Web Publish</th>
  
</tr>

<?php

foreach ($response->records as $record) {
		
echo "<tr>";
echo "<td>".$record->Subject."</td>";
echo "<td>".$record->Description."</td>";
echo "<td>".$record->EndDateTime."</td>";
echo "<td>".$record->StartDateTime."</td>";
echo "<td>".$record->OwnerID."</td>";
echo "<td>".$record->Public_Name__c."</td>";
echo "<td>".$record->Web_Publish__c."</td>";

echo "</tr>";
	

}


?>

 

The results are shown here.  The event fields  subject, description and start and end times display (  times need formatting sensibly !)  but niether of the custom fields or the field ownerid appear.  One of the custom fields (Web_Publish__c) is used to filter the results, so the query recognises the field - but for some reason this fails to display.  Using the Office Toolkit, all of this data correctly appears in Excel or Access. 

 

It seems to me the problem is a php display issue.  I must be doing something silly.

 

Any help much appreciated !  Thanks.

 

Best Answer chosen by Admin (Salesforce Developers) 
peterpptpeterppt

Problem has now disappeared by re-typing the line of code displaying OwnerID.  So this problem was a red-herring, sorry ! 

 

Peter

All Answers

peterpptpeterppt

I've sorted the problem with the custom fields -  I needed to generate an installation specific WSDL - not simply use the default which comes when you install the php toolkit.

 

But I still can't display the OwnerID field !

 

This is the field that displays a user name  (e.g Peter Smith ) in the Event Form but stores the id (e.g 023b000000098DnAAI) -  but I can't even get the ID to show.

 

Anyone else had this problem - and come up with an explanation/solution ?

 

Thanks

 

peterpptpeterppt

Problem has now disappeared by re-typing the line of code displaying OwnerID.  So this problem was a red-herring, sorry ! 

 

Peter

This was selected as the best answer