• mbbender
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 12
    Replies
I'm having some trouble getting data from PHP back to my salesforce javascript s-control.

I'm calling the remoteFunction and the PHP script is being called and generating data as expected. The response time for the PHP script to finish is probably near the 10 second timeout period.

1) Can the 10 second timeout with the remoteFunction be modified?

I would like to process the returned data from php. How do I return data to the onSuccess callback? In my PHP code I've tried print($returndata) and  return $returndata to get the JSON formatted string back to salesforce. I've not had any luck with either.

When I call the remoteFunction method the onSuccess function immediately is called and executed. If I wait about 5-10 seconds my PHP print() statement will print to the sforce debug console window.

I would like to onSuccess callback to be called when the PHP returns it's information. I've tried setting the async argument to false but it did not change operation and onSuccess is still called immediately.

Any ideas on how to get my PHP data back to salesforce when using the remoteFunction method?
I'm trying to just setup a simple connection between my javascript S-control and a hosted php script. I'm using the AJAX proxy example.

I'm having troubles accessing the requestData information in PHP. Can anyone provide the PHP code needed to access the "hello world" string?

Once I access the "hello world" string I'll move to sending JSON objects so if you can provide any color around that as well it would be greatly appreciated.

Thanks.

JavaScript S-Control:
sforce.connection.remoteFunction(
{
url: "http://subdomain.mydomain.com/mbbtest.php",
requestHeaders: {"Content-Type": "text/plain"},
mimeType: "text/plain",
requestData: "hello world",
method: "POST",
onSuccess: function(response) {
sforce.debug.log("success: "+response);
},
onFailure: function(response) {
sforce.debug.log("failure: "+response);
}
}
);



PHP Code that does not work
<—php
error_log("----------------");
error_log($_REQUEST['requestData']);
–>

 

Does anyone have a good debug environment or resources for inspecting and/or walking through the cross-domain information transfer?
 
I'm using the following code and am having troubles determining if my php script is even being called and if so what I should be expecting in php.
 
Code:
function sendObj(objectToSend) {
sforce.debug.log("Sending object: " + {"contactContainer":objectToSend});
try{
sforce.connection.remoteFunction(
{
url: "http://mydomain.com/middleware.php",
requestHeaders: {"Content-Type": "application/x-www-form-urlencoded"},
requestData: {"contactContainer":objectToSend},
mimeType: "text/xml",
method: "POST",
onSuccess: function(response) {
document.getElementById("result").value = response.textContent;
},
onFailure: function(response) {
document.getElementById("result").value = "Failed " + response;
}
}
);
}catch(e){
alert("Error in sendObj: " + e);
}
} // end sendObj

 
Code not working for some reason. Any ideas.
 
Code:
var oppContactRole = new sforce.SObject("OpportunityContactRole");
oppContactRole.ContactId = '0037000000RjQis';
oppContactRole.OpportunityId = '00670000009RroZ';
oppContactRole.Role = 'Hidden Contact';
sforce.connection.Create({oppContactRole});

 
I get the error:
missing : after id property
I'm new to this salesforce development thing so work with me here.
 
I added a custom link on the opportunity that is set to execute some javascript. In the javascript that is to be executed I would like to use information specific to the opportunity where the link was clicked.
 
How do I get the information such as opportunity name and opportunity contacts inside my javascript?
Hi,

We are facing storage issue since use of heavy attachments and more emails.
We know Case Detachifier Apps is best use in this case.

But it makes dependency with internal server.
How can we hanlde this issue.

Any suggestions highly appreciated

Thanks
Nazeer
  • August 16, 2007
  • Like
  • 0
hi there,

we're using php_sforce_nusoap, and have been shocked by this line of code inside the package:

$this->client->forceEndpoint = str_replace("https", "http", $url);

(see php_sforce_nusoap/salesforce.php, function setURL($url))


we've modified the line like this:

 $this->client->forceEndpoint = $url;

and it still works.


sooo... question is:
why would they replace HTTPS by HTTP?
and why does it still work without the replacement?
which protocol does it use, after all?!
how secure is php_sforce_nusoap?!?!


any comments appreciated,
thanks in advance,

regards,
roMan

Does anyone have a good debug environment or resources for inspecting and/or walking through the cross-domain information transfer?
 
I'm using the following code and am having troubles determining if my php script is even being called and if so what I should be expecting in php.
 
Code:
function sendObj(objectToSend) {
sforce.debug.log("Sending object: " + {"contactContainer":objectToSend});
try{
sforce.connection.remoteFunction(
{
url: "http://mydomain.com/middleware.php",
requestHeaders: {"Content-Type": "application/x-www-form-urlencoded"},
requestData: {"contactContainer":objectToSend},
mimeType: "text/xml",
method: "POST",
onSuccess: function(response) {
document.getElementById("result").value = response.textContent;
},
onFailure: function(response) {
document.getElementById("result").value = "Failed " + response;
}
}
);
}catch(e){
alert("Error in sendObj: " + e);
}
} // end sendObj

 
Code not working for some reason. Any ideas.
 
Code:
var oppContactRole = new sforce.SObject("OpportunityContactRole");
oppContactRole.ContactId = '0037000000RjQis';
oppContactRole.OpportunityId = '00670000009RroZ';
oppContactRole.Role = 'Hidden Contact';
sforce.connection.Create({oppContactRole});

 
I get the error:
missing : after id property
I'm new to this salesforce development thing so work with me here.
 
I added a custom link on the opportunity that is set to execute some javascript. In the javascript that is to be executed I would like to use information specific to the opportunity where the link was clicked.
 
How do I get the information such as opportunity name and opportunity contacts inside my javascript?