• msimonds
  • NEWBIE
  • 172 Points
  • Member since 2006

  • Chatter
    Feed
  • 7
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 48
    Questions
  • 190
    Replies

Is there a way utilizing the PHP API to read an objects schema and list its meta data.

 

I would like to be able to pass an object name and see all of the field names and their types and even better if the type happens to be a picklist to determine what the available options are.

 

Can someone point me in the right direction or provide a sample?

 

Hi,

 

What I need to do is so simple in theory, otherwise I would not be writing this post!

 

The point is that I have an HTML registration form, where the action parameter triggers a PHP script which already executes some stuff. What I need to do, is additionally create a new load in the salesforce system with this form information, maybe writing some PHP code at the end of this script to generate an XML file for example, send this file to salesforce and create the lead. That's all.

 

I don't have any problem to write the PHP code, but I don't know the procedure to do the integration with the salesforce system, could you help me with that?

 

Thanks a lot!

 

 

Hi,


I know there are a few threads on this already - believe me I have been reading them. I am using the latest version of the PHP Toolkit I could find (13.1) and trying to I am attempting to access the Sandbox.

 

Here's what I have done:

 

  • Got a fresh enterprise and partner wsdl from the sandbox site and tried them both.
  • Made sure to include the sandbox name or whatever it's called at the end of the username, so email@address.com.thing
  • Refreshed the security token and appended that to the password.
  • Tried to use the WSDLs which come with the Toolkit instead, changing the endpoint to be test.salesforce.com/etc..

I noticed the endpoint in the Toolkit included "13" - since the toolkit is version 13, is there a more up to date version of the Toolkit to go with the latest API since the endpoint in the fresh WSDLs from my Sandbox is uses "20" instead of "13"?


All I'm doing so far is...

 

$sf = new SforceEnterpriseClient();
$sf->createConnection(WSDL_PATH);
$sf->login(array('username' => USERNAME, 'password' => PASSWORD . '.' . TOKEN));

 

And I get an error response of...

 

INVALID_LOGIN: Invalid username, password, security token; or user locked out.

 

I can login ok if I bypass the Toolkit...

 

$sf = new SoapClient(WSDL_PATH);
$result = $sf->login(array('username' => USERNAME, 'password' => PASSWORD . '.' . TOKEN));

 

But the only problem then is obviously spending the time working out how to do what I need to do (create leads) without the Toolkit's helper methods, so I'd obviously rather rather use the Toolkit if I can.


Any advice would be gratefully received!

 

EDIT: forgot to mention that I have used ini_set("soap.wsdl_cache_enabled", "0"); too but that didn't help.

Hi all,

Very new to Saleforce API here. As a first step I'm trying to connect to salesforce using a connection string as it's done in php. I have found some sample codes, but there are references to files that I don't have. I assume they exist somewhere on the developmerforce, but I can't find them. Would you be able to let me know where?

Thanks.

Sia44

How can I get Query More to return a result set in XML rather than arrary of objects? I am using PHP.

Hi there,

 

I would like to know how can get the user information (like the Saleforce userid email address) using php?? Thanks!

i have this error. and i cant solve it for now. im using a php toolkit 11. and xampp.

 

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in 'C:/xampp/htdocs/phptoolkit/soapclient/partner.wsdl.xml' in C:\xampp\htdocs\phptoolkit\soapclient\SforceBaseClient.php:121 Stack trace: #0 C:\xampp\htdocs\phptoolkit\soapclient\SforceBaseClient.php(121): SoapClient->SoapClient('C:/xampp/htdocs...', Array) #1 C:\xampp\htdocs\phptoolkit\samples\integration.php(17): SforceBaseClient->createConnection('C:/xampp/htdocs...') #2 {main} thrown in C:\xampp\htdocs\phptoolkit\soapclient\SforceBaseClient.php on line 121

 

 

please help me.. tnx :)

Hi

I am using following script to send data into the SF. This is working properly for me but the script does not update Google Lead Tracking. What can be the reason? Please help...

 

<?php
//do quality checks on the incoming data here.

//then bundle the request and send it to Salesforce.com
$req  = "&lead_source=". urlencode($_REQUEST["leadSource"]);
$req .= "&first_name=" . urlencode($_REQUEST["firstName"]);
$req .= "&last_name=" . urlencode($_REQUEST["lastName"]);
$req .= "&title=" . urlencode($_REQUEST["title"]);
$req .= "&company=" . urlencode($_REQUEST["company"]);
$req .= "&email=" . urlencode($_REQUEST["email"]);
$req .= "&phone=" . urlencode($_REQUEST["phone"]);
$req .= "&street=" . urlencode($_REQUEST["street"]);
$req .= "&city=" . urlencode($_REQUEST["city"]);
$req .= "&state=" . urlencode($_REQUEST["state"]);
$req .= "&zip=" . urlencode($_REQUEST["zip"]);
$req .= "&debug=" . urlencode("0");
$req .= "&oid=" . urlencode("<Your Salesforce Org Id here>");
$req .= "&retURL=" . urlencode("<Your return url here>");
$req .= "&debugEmail=" . urlencode("<email for debugging>");

$header  = "POST /servlet/servlet.WebToLead?encoding=UTF-8 HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: www.salesforce.com\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.salesforce.com', 80, $errno, $errstr, 30);
if (!$fp) {
echo "No connection made";
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
echo $res;
}
}
fclose($fp);
?>

 

I have been tasked with getting this up and running and haven't done anything quite this involved yet.  On the salesforce side in particular  I am not sure what  I need in the http/php class to get the login to function.

 

Any thoughts on where to go from that? 

 

thank you,

 

 

In the past I was hitting the govenor limit of 21 quieres and have been able to work through that, but after I retooled my trigger and class, I am getting the same error.

 

I have this trigger:

 

trigger UpdateOppChatterFeed on OpportunityLineItem (after update) 
{
      integer size = Trigger.new.size();

      for(integer i = 0; i < size; i++)
      {
            Chatter_Feed cf = new Chatter_Feed();
            cf.updateChatter(Trigger.new[i]);
      }
}

 

 

which calls this class:

 

 

public with sharing class Chatter_Feed 
{

	public void updateChatter(OpportunityLineItem  oli)
	{
            List<FeedPost> posts = new List<FeedPost>();
            List<Opportunity> oppList = new List<Opportunity>();
            List<Opportunity> OppsToBeUpdated = new List<Opportunity>();
            
            oppList = [select Id
            		   from Opportunity 
            		   where id = : oli.OpportunityId];
            		   
						
            id idToUpdate;   
            for(Opportunity opp : oppList)
            {
                  idToUpdate = opp.Id;			
            }
	    System.debug('MIKES OPP ID IS '  + idToUpdate);
            //update OppsToBeUpdated;
            List<OpportunityFeed> opportunityFeedPosts = [SELECT Id, Type, FeedPost.Body
                                                            From OpportunityFeed
                                                            Where ParentID = :idToUpdate
                                                            ORDER BY CreatedDate DESC];
                                                            
                                                            
            String bodyText = 'This is the body ';                                                
            FeedPost opportunityPost = new Feedpost();
            opportunityPost.Type = 'LinkPost';
            opportunityPost.Title = 'THIS IS THE TITLE WILL';
            opportunityPost.Body = bodyText;
            String id = String.valueOf(oli.id).substring(0,15);
            opportunityPost.LinkURL = 'https://cs1.salesforce.com/'+id;
            opportunityPost.ParentID = idToUpdate;
            posts.add(opportunityPost);
            	
            //}                                        
                                                            
            insert posts;                                              

      }
 
  
}

 

 

The only for() loop that I have is in the class and does not query any sObjects.

 

This trigger/class works when I edit 1 OpportunityLineItem, but our Org has an option to edit all and in some cases, there are more than 21 line items on an Opportunity.

 

Why is this failing?  Can someone please give me some guidance here?

 

 

I would appreciate any feedback

 

Thanks!!

 

~Mike

I am trying to get this trigger to update a new, test field (TEXT FIELD, 18 bytes) with the ID of the Opportunity Line Item and the error that I am receiving is Id not specified in the update call.

 

 

 

 

trigger New_Feed_Update on OpportunityLineItem (after update) 
{
	//setup a feedpost array
	List<FeedPost> posts = new List<FeedPost>();
	
	//Create a new, empty list to add the Socket ID's to update
	List<OpportunityLineItem> oppGetIds = new List<OpportunityLineItem>();
	//mike_test__c
	for(OpportunityLineItem oppids : Trigger.new)
	{
		OpportunityLineItem Opp = new OpportunityLineItem();
		Opp.will_test__c = oppids.id;
		OppGetIds.add(Opp);
	}
    Database.update(OppGetIds);



}

 

 

I thought that the ID was already identified in the update call

 

Can someone please help me fix this trigger

Hi all,

 

Sorry but this may be another really basic question that I can't find the answer too, does anyone have the code which uses the PHP toolkit API connections, and allows for a user to register on the SalesForce site?

 

Also what are the minimum amount of fields necessary for a user to register?

 

Thanks in advance, for any help or advice.

I have a custom object in our Salesforce setup called AgentProducts, when I do a query (code running in php) via the API the only field I can get back is Id;

 

select Id, User_Id__c from AgentProducts__c

 

returns a record for every one of the entries in AgentProducts, but only with the Id field;

Array
(
    [0] => stdClass Object
        (
            [Id] => a0350000008xWWKAA2
        )

    [1] => stdClass Object
        (
            [Id] => a0350000008xWWLAA2
        )
etc. 

 

Even worse, if I filter the query by something like my custom email field, I get back the correct Id for the correct account, but still, no further data;

select Id, User_Id__c from AgentProducts__c where Email__c='xxx@xxxxx.xxx'

 

returns:

stdClass Object
(
    [Id] => a0350000008xWWMAA2
)

 

Any ideas?  I've been looking through the online documentation but I can't find anything on custom objects needing special treatment.

 

Hi all.

 

We have a PHP web app talking to SF.  We have converted a Lead to an Account, and are then trying to update the account and getting the error when playing in the sandbox:

Sales Force Update object Failed: attempt to violate hierarchy constraints

 

Unfortunately, there's no documentation on this error anywhere, and it seems like we're the only ones getting it.

 

Can anyone shed some light on what this means?  The same code works fine when talking to the live SalesForce.

 

Thanks

Todd

 

I have a query that returns info that I need to paginate. I can return all records or limit to however many records I'd like, but I'd like to set up a page system that allows me to return a specified number of records and then dynamically create a page numbering system of links at the bottom of the report to go to additional pages of records. I have the whole system set up and working, but cannot figure out how to retrieve records starting after the records I've already retrieved.
 
For example,...
 
Page one shows the first 20 records.
 
Page two should show the next 20, but I need something equivilent to SQL's LIMIT 20,20 to start my query at record #20 and then retrieve 20 records. Does SOQL have a function like this?
 
Thank you all very much in advance.