• vladislav
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

Hello. I'm using the PHP ToolKit version 20.0. I'm just doing a simple query to SUM some fields and return the result. It works just fine when I connect from localhost, but as long as I upload my code to a remote host and execute it from there I get empty result for records... Here is my code:

 

$mySforceConnection = new SforcePartnerClient();
$mySforceConnection->createConnection('partner.wsdl.xml');
$mySforceConnection->login($USERNAME, $PASSWORD.$SECURITY_TOKEN);

$options = new QueryOptions(2000); $mySforceConnection->setQueryOptions($options); 

$query = "SELECT SUM(Financial_Savings__c) FROM Opportunity"; 

$response = $mySforceConnection->query($query); 

print_r($queryResult); 
exit;

 

And the result on localhost is:

 

QueryResult Object
(
    [queryLocator] => 
    [done] => 1
    [records] => Array
        (
            [0] => SObject Object
                (
                    [type] => AggregateResult
                    [fields] => stdClass Object
                        (
                            [expr0] => 1098.35
                        )

                )

        )

    [size] => 1
)

 

 And the result from the remote host, where I upload exactly the same file and run it from there:

 

QueryResult Object
(
    [queryLocator] => 
    [done] => 1
    [records] => Array
        (
            [0] => SObject Object
                (
                    [type] => AggregateResult
                    [fields] => stdClass Object
                        (
                        )

                )

        )

    [size] => 1
)

 You can see that the [fields] are empty !

Anybody can help me with this?

Thanks.

Hello. I'm new to SiteForce and *force services as general, so my question might have its answer somewhere, but I still can't find it. So, I've created a site, using SiteForce. The problem I'm having now is that on every page on this site I need to display some data, which comes from SalesForce and I don't know how to do that. The data is handled as follows: I look for all fields with certain name (these fields contain some numbers in them), get their values, make an aggregate on their values and show it in my site. For example: I've got this custom field "price", for different products, presented as custom objects, so one has a value of 10, another is 20 and another is 30. I need to pull this data, make a calculation as follows: (10+20+30) / 3 == 20 and I need to display this "20" on my SiteForce website. So is this possible and how? I might need to use APEX to pull the data, but don't know how to show the result on the page... If you can just give me some more information on what should I use to get this done. Any help will be appreciated. Thanks.

I am running into a problem with the PHP SDK and aggregate functions.  We are trying to do a very simple calculation that counts the number of records by each MailingState.  Our query is as follows:

 

$query = "SELECT MailingState, count(Contact.Id) from Contact WHERE MailingState != '' GROUP BY MailingState";
$response = $mySforceConnection->query($query);

 

When I run the PHP code on my local MAMP stack the $response array returns back properly with MailingState and the expr0 count.  However when I run the same code on our remote webserver (Rackspace Cloud Sites), the $response array only shows the MailingState and does not return the aggregate calculation.  

 

Has anyone run into this problem before?  is there something that we should be looking for in the PHP config?

 

Thanks,

-Matt

Hello. I'm using the PHP ToolKit version 20.0. I'm just doing a simple query to SUM some fields and return the result. It works just fine when I connect from localhost, but as long as I upload my code to a remote host and execute it from there I get empty result for records... Here is my code:

 

$mySforceConnection = new SforcePartnerClient();
$mySforceConnection->createConnection('partner.wsdl.xml');
$mySforceConnection->login($USERNAME, $PASSWORD.$SECURITY_TOKEN);

$options = new QueryOptions(2000); $mySforceConnection->setQueryOptions($options); 

$query = "SELECT SUM(Financial_Savings__c) FROM Opportunity"; 

$response = $mySforceConnection->query($query); 

print_r($queryResult); 
exit;

 

And the result on localhost is:

 

QueryResult Object
(
    [queryLocator] => 
    [done] => 1
    [records] => Array
        (
            [0] => SObject Object
                (
                    [type] => AggregateResult
                    [fields] => stdClass Object
                        (
                            [expr0] => 1098.35
                        )

                )

        )

    [size] => 1
)

 

 And the result from the remote host, where I upload exactly the same file and run it from there:

 

QueryResult Object
(
    [queryLocator] => 
    [done] => 1
    [records] => Array
        (
            [0] => SObject Object
                (
                    [type] => AggregateResult
                    [fields] => stdClass Object
                        (
                        )

                )

        )

    [size] => 1
)

 You can see that the [fields] are empty !

Anybody can help me with this?

Thanks.

Hello. I'm new to SiteForce and *force services as general, so my question might have its answer somewhere, but I still can't find it. So, I've created a site, using SiteForce. The problem I'm having now is that on every page on this site I need to display some data, which comes from SalesForce and I don't know how to do that. The data is handled as follows: I look for all fields with certain name (these fields contain some numbers in them), get their values, make an aggregate on their values and show it in my site. For example: I've got this custom field "price", for different products, presented as custom objects, so one has a value of 10, another is 20 and another is 30. I need to pull this data, make a calculation as follows: (10+20+30) / 3 == 20 and I need to display this "20" on my SiteForce website. So is this possible and how? I might need to use APEX to pull the data, but don't know how to show the result on the page... If you can just give me some more information on what should I use to get this done. Any help will be appreciated. Thanks.