You need to sign in to do that
Don't have an account?
DPac
Calling APEX code from Scontrol and trying to pass a Date and timestamp
I am trying to pass the date and time stamp to a webservice method in APEX code and the apex method returns a boolean.
My code snippet are as follows:
Apex Code:
================================================
package csaContractBatch{
webService boolean csaWebServiceBatch(Datetime lastRunDate){
System.debug('lastRunDate:'+lastRunDate);
return true;
}
================================================
Scontrol Code:
===========
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/soap/ajax/8.0/apex.js" type="text/javascript"></script>
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function initPage(){
sforceClient.useCookies = true;
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_80}", true);
setTimeout("setup()",50);
}
function setup(){
now = new Date();
var apexCode = sforce.apex.execute("csaContractBatch","csaWebServiceBatch",{lastRunDate:now});
alert(apexCode);
}
</script>
</head>
<body onload="javascript:initPage();">
</body>
</html>
========================================================================
When I click the link that calls this scontrol I get the following error in my browser debugger:
uncaught exception: {faultcode:'soapenv:Server', faultstring:, }
Can you please help.
My code snippet are as follows:
Apex Code:
================================================
package csaContractBatch{
webService boolean csaWebServiceBatch(Datetime lastRunDate){
System.debug('lastRunDate:'+lastRunDate);
return true;
}
================================================
Scontrol Code:
===========
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/soap/ajax/8.0/apex.js" type="text/javascript"></script>
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function initPage(){
sforceClient.useCookies = true;
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_80}", true);
setTimeout("setup()",50);
}
function setup(){
now = new Date();
var apexCode = sforce.apex.execute("csaContractBatch","csaWebServiceBatch",{lastRunDate:now});
alert(apexCode);
}
</script>
</head>
<body onload="javascript:initPage();">
</body>
</html>
========================================================================
When I click the link that calls this scontrol I get the following error in my browser debugger:
uncaught exception: {faultcode:'soapenv:Server', faultstring:, }
Can you please help.
This will give you more detials:
Code:
But with the string parameter it worked fine.