Joined: 23 Aug 2010 |
Posts: 1 |
Location: Boston, MA |
|
|
Posted: Mon Aug 23, 2010 2:59 pm |
|
|
|
|
|
I'm using NuSOAP with Salesforce's API service. I have a script and would like to deal with some pieces as functions, but whenever I do that I get fatal errors like:
Fatal error: Call to a member function create() on a non-object
If I simply just paste my code within my script, it works great! However if I work it as a function, it is as if NuSOAP can't find what it needs to... ummm, function. Do I need to pass something in particular to the function to make it work?
Thanks! Example below.
-Chuck
eg:
// my main run.php script:
require_once('functions.php');
require_once('salesforce.php'); // this file has the include for the nusoap.php library
$username = 'sfapi@mydomain.com';
$password = '*******';
task_update($sfid,$thecampaignid);
// task update function from functions.php below.
function task_update($sfid,$campaignid) {
// update the task list with this item
$thedate = date('m/d/Y');
$thedate = gmdate("Y-m-d H:i:s", time());
$task = new sObject('Task',
null,
array(
'WhoID' => $sfid,
'Description' => 'Another activity detail on ' . $thedate,
'Status' => 'Completed',
'Subject' => ' Activity logged: ' . $campaignid
)
);
$createResult = $sfdc->create($task);
}
// end of function
|
|