I am trying to migrate classes from an older API version to a moderately higher version, while doing so I came across a JS button which calls an apex method and creates a record. This has stopped working when I change the version number of the class from 26 to 40 and I get a error message as show in the screenshot below. But when I revert the version back to 26 it works well. I also tried to check the considerations and forward compatibility of these JS buttons but I wasn't able to find any article on it. I have also added the code for your reference. Can someone let me know how to fix it?
JS Button :
{!REQUIRESCRIPT("/soap/ajax/40.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/40.0/apex.js")}
var oppId= "{!Opportunity.Id }";
var accId= "{!Opportunity.AccountId}";
var url = parent.location.href;
//sforce.debug.trace=true;
var status = sforce.apex.execute("NewQuoteRequestHelper2", "createResquest", {a:oppId, b:accId});
//sforce.debug.trace=true;
if( status == 'true'){
parent.location.href = url;
}
Apex class :
global class NewQuoteRequestHelper2{
webservice static string createResquest (Id oppId, Id accId){
string ret = 'false';
//Opportunity o= [SELECT AccountId, ContactId, Id, _Name__c, Status, Subject, Type, Date_Due__c, Origin FROM Case where id=: oppId];
case c= new case();
c.AccountId= accId;
c.Opportunity_Name__c= oppId;
c.Status= 'Not Started';
c.Subject='Please Generate Quote';
//c.Type="Request Quote" ;
c.Date_Due__c= system.today();
c.Origin='Opportunity';
insert c;
ret ='true';
return ret;
}
}
{a:oppId, b:accId}
and not{oppId:oppId, accId:accId}
?