I have been trying to get through the loop on sObjects with no luck. I have gone through the PHP eval() that Mike put together on this site, but all I ever got back was 65 fields of the main ID, not all of the sObjects and thier fields. When I do what I am doing below, I get the error
"Object of class SObject could not be converted to string" and I am just stumped on what field is incorrect. I would love to be able to use the eval on the below code and dump that to the returning array.
Any help or guidance will be greatly appreciated. Thank you,
function getSalesforceIDInfoMonster($salesforce_id)
{
global $mySforceConnection;
$query = "Select o.W_L_D_Comments__c, o.Type, o.TotalOpportunityQuantity, o.Telemarketing_Manager__r.Manager__c,
o.Telemarketing_Manager__c, o.Telemarketing_Agent__r.Name, o.Telemarketing_Agent__r.Id,
o.Telemarketing_Agent__c, o.SystemModstamp, o.Suite__c, o.Sub_Type__c, o.StageName,
o.Sourceofurgency__c, o.Short_Description__c, o.Sales_Representative__c, o.Regional_Sales_Mgr__c,
o.RecordTypeId, o.Reason_Lost__c, o.Probability, o.Primary_Competitor__c, o.Pricebook2Id,
o.Planned_Start_Date__c, o.Planned_Finish_Date__c, o.PSA_Opp_ID__c,
o.Owner.Manager_Emp__c, o.Owner.Manager__c, o.Owner.ForecastEnabled, o.Owner.UserPermissionsAvantgoUser,
o.Owner.UserPermissionsWirelessUser, o.Owner.UserPermissionsOfflineUser, o.Owner.UserPermissionsMarketingUser,
o.Owner.OfflineTrialExpirationDate, o.Owner.SystemModstamp, o.Owner.LastModifiedById, o.Owner.LastModifiedDate,
o.Owner.CreatedById, o.Owner.CreatedDate, o.Owner.LastLoginDate, o.Owner.WirelessEmail, o.Owner.EmployeeNumber,
o.Owner.LanguageLocaleKey, o.Owner.ProfileId, o.Owner.CurrencyIsoCode, o.Owner.DefaultCurrencyIsoCode,
o.Owner.EmailEncodingKey, o.Owner.ReceivesInfoEmails, o.Owner.LocaleSidKey, o.Owner.UserRoleId,
o.Owner.TimeZoneSidKey, o.Owner.IsActive, o.Owner.Alias, o.Owner.MobilePhone, o.Owner.Fax, o.Owner.Phone,
o.Owner.Email, o.Owner.Country, o.Owner.PostalCode, o.Owner.State, o.Owner.City, o.Owner.Street,
o.Owner.Title, o.Owner.Department, o.Owner.Division, o.Owner.CompanyName, o.Owner.FirstName, o.Owner.LastName,
o.Owner.Username, o.Owner.Id, o.OwnerId, o.Opportunity_ID__c, o.Number_of_SHCM_Products__c,
o.Number_of_S3_Products__c, o.Number_of_M3_Products__c, o.Name, o.Marketing_Import_Information__c,
o.Maintenance_Amount__c, o.Lost_To__c, o.Lost_To_Other__c, o.Lead_Source_Code__c, o.LeadSource,
o.LastModifiedDate, o.LastModifiedById, o.LastActivityDate, o.IsWon, o.IsClosed, o.Inside_Sales__c,
o.Inside_Sales_Rep__c, o.Id, o.Forecast__c, o.ForecastCategoryName, o.ForecastCategory, o.FiscalYear,
o.FiscalQuarter, o.Fiscal, o.Executive_Forecast__c, o.Entry_Date__c, o.Discount__c, o.Description,
o.Deferred_on_Date__c, o.Customer_Type__c, o.Current_Client_Product__c, o.CurrencyIsoCode, o.CreatedDate,
o.CreatedById, o.Contract_Status__c, o.Contract_Received__c, o.Complete_RADAR_encrypted__c,
o.Competition_Description__c, o.CloseDate, o.CampaignId, o.Associated_GPS__c, o.Amount,
o.Account.Lawson_Industry__c, o.Account.Support_Level__c, o.Account.Business_Unit__c,
o.Account.Business_Unit_Override__c, o.Account.Official_Name__c,
o.Account.Workgroup__c, o.Account.D_U_N_S__c, o.Account.Marketing_Import_Information__c,
o.Account.Import_Tag__c, o.Account.X3rd_SIC_Industry__c, o.Account.X3rd_SIC_Segment__c,
o.Account.X2nd_SIC_Segment__c, o.Account.X2nd_SIC_Industry__c, o.Account.Do_Not_Contact__c,
o.Account.Population__c, o.Account.of_Facilities__c, o.Account.Outpatient_Visits_Year__c,
o.Account.of_Beds__c, o.Account.Inpatient_Visits_Year__c, o.Account.Client_Fiscal_Year_End__c,
o.Account.Primary_SIC_Segment__c, o.Account.Client_Since__c, o.Account.Primary_SIC_Industry__c,
o.Account.CTPS__c, o.Account.Vertical__c, o.Account.Global_Location__c, o.Account.Phone_Ext__c,
o.Account.Micro_Segment__c, o.Account.Status__c, o.Account.SIC_Code2__c, o.Account.SIC_code__c,
o.Account.Client_ID__c, o.Account.Country_Code__c, o.Account.X3rd_SIC_Code__c, o.Account.IsPartner,
o.Account.SystemModstamp, o.Account.LastModifiedById, o.Account.LastModifiedDate, o.Account.CreatedById,
o.Account.CreatedDate, o.Account.OwnerId, o.Account.CurrencyIsoCode, o.Account.TickerSymbol,
o.Account.Ownership, o.Account.NumberOfEmployees, o.Account.AnnualRevenue, o.Account.Industry,
o.Account.Website, o.Account.Fax, o.Account.Phone, o.Account.ShippingCountry, o.Account.ShippingPostalCode,
o.Account.ShippingState, o.Account.ShippingCity, o.Account.ShippingStreet, o.Account.BillingCountry,
o.Account.BillingPostalCode, o.Account.BillingState, o.Account.BillingCity, o.Account.BillingStreet,
o.Account.ParentId, o.Account.Name, o.Account.Id, o.AccountId From Opportunity o
Where o.Id = '$salesforce_id'";
try
{
$response = $mySforceConnection->query(($query));
$queryResult = new QueryResult($response);
/* Error occurred, return given name by default */
if(!$queryResult|| $queryResult->size < 1)
{
return NULL;
}
foreach ($queryResult->records as $record)
{
$dbarray[]=$record;
}
}
catch (Exception $e)
{
print_r($mySforceConnection->getLastRequest());
echo $e->faultstring;
}
return $dbarray;
} //end func
<
html>
<
head>
<linkrel="stylesheet"type="text/css"media="screen"href="styles.css"/>
</head>
<body>
<?php
//test getSalesforceIDInfoMonster($salesforce_id)
echo
"<h1>getSalesforceIDInfoMonster($salesforce_id)</h1>";
$salesforceInfo = getSalesforceIDInfoMonster("0063000000Gd0MIAAZ");
//$salesforceInfo = getSalesforceIDInfoMonster("006S0000002eGNaIAM");
echo "<table>";
foreach ($salesforceInfo as $key => $value)
{
echo "<tr><td>$key</td><td>$value</td></tr>";
}
echo "</table>";
echo "<h1>END getSalesforceIDInfoMonster($salesforce_id) test</h1>";
echo "<hr>";
?>
</body>
</html>
Bookmarks