0

Afternoon,

I am currently having an issue displaying data from newly added fields within my php page?

Here is an example. [http://cvm.org.uk/salesforce/sport-details?id=003D000001r6G3tIAE][1]

<?php
// session_start() has to go right at the top, before any output!
session_start();
ini_set('soap.wsdl_cache_enabled', '0');
?>
<?php require_once('../Connections/salesforceconnect.php');?>

<body>
<?php $query = sprintf("select firstname, lastname, Email, MailingCity, MailingState, Publicity_Description_del__c, Profile_Image__c, Facebook_URL__c, Football_Club__c  from contact where id = '%s'", $_GET['id']);
$response = $mySforceConnection->query($query);
foreach($response->records as $record) { ?>
<font size="+3"><?php echo $record->FirstName." ".$record->LastName ?></font><br />
<img src="<?php echo $record->Profile_Image__c ?>" width="150px" height="150px" hspace="10px" vspace="10px" align="left"/>
<table style="margin-left: 160px !important;" width="367" border="0" align="center">
  <tr>
    <th colspan="2" scope="col"><h2 align="left">Basic Information</h2></th>
  </tr>
  <tr>
    <td width="85"><b><font size="1">Football Club:</font></b></td>
    <td width="272"><font size="2"><?php echo $record->Football_Club__c ?> &lt;&lt; Missing information</font></td>
  </tr>
  <tr>
    <td><b><font size="1">Home Town:</font></b></td>
    <td><font size="2"><?php echo $record->MailingCity ?>, <?php echo $record->MailingState ?></font></td>
  </tr>
</table>
<br>
<br>
<br>
<br>
<br>
<table width="637" border="0">
  <tr>
    <th colspan="2" scope="col"><h2 align="left">Basic Information</h2></th>
  </tr>
  <tr>
    <td width="85"><b><font size="1">About <?php echo $record->FirstName ?>:</font></b></td>
    <td width="542"><font size="2"><?php echo $record->Publicity_Description_del__c ?></font></td>
  </tr>
  <tr>
    <td><b><font size="1">Email:</font></b></td>
    <td><p><font size="2"><?php echo $record->Email ?></font></p></td>
  </tr>
  <tr>
    <td colspan="2"><p><font size="2"><a href="<?php echo $record->Facebook_URL__c ?>">Join <?php echo $record->Football_Club__c ?> Football Group</a></font> <font size="2">&lt;&lt; Missing information</font> </p></td>
  </tr>
</table>
<?php } ?>
</body>
</html>

Missing data is the in the image and where shown on webpage.

Any advice? :S

Many thanks Kirsty

17
  • 2
    Could you post your code in using the Preformatted text tool? Makes it a bit easier to read and inspect! :) One thing I would check, assuming you're using SOAP, check that your WSDL file is up date. You can download this by going to Setup > Develop > API and choosing either the Partner or Enterprise WSDL file. Replace this and let us know if you get anything different. The WSDL file effectively describes things like fields, objects within it. So I'd wager this is definitely at least one reason you're not pulling anything through. Especially if they are, as you say "newly added fields".
    – Dan Jones
    Aug 18 '15 at 11:23
  • It may also be worth doing print_r($response) and sharing that code with us, to see what Salesforce is returning.
    – Dan Jones
    Aug 18 '15 at 11:34
  • I will give updating the WSDL file a try, I haven't touched that file since I set the connection up over a year ago.
    – Kirsty
    Aug 18 '15 at 11:44
  • Perfect. I've put this as an answer to the question. I'd say this is the most likely reason at present.
    – Dan Jones
    Aug 18 '15 at 11:46
  • I've updated the file,.....
    – Kirsty
    Aug 18 '15 at 11:48
1

It looks like you're using SOAP. If the fields are, as you say,

newly added fields

One reason could be that your WSDL files are out of date. To download this, go to

Setup > Develop > API

Choose either the Partner or Enterprise WSDL file to download (if you're unsure, downloading both shouldn't hurt) and replace the files in your 'soapclient' folder.

The WSDL files effectively describe objects, fields et al. So if this is out of date and those objects and fields aren't described, they can't be accessed.

Edit: It may be worth updating your soapclient folder by going here and downloading the latest version (don't forget to re-replace the WSDL files).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.