I have the following apex method and this method i am going to use in custom detail button but the problem is it will give me an error as following :
Apex Method :
public pagereference StartSync(){
try{
opp = [Select Id, AccountId from Opportunity where id =: Quote.OpportunityId];
opp.SyncedQuoteId = Quote.Id;
opp.Tax__c = Quote.Tax__c;
opp.Freight_Amount__c = Quote.Freight__c;
update opp;
pagereference pg = new Pagereference('/apex/QuoteDetail?id='+this.Quote.Id);
pg.setRedirect(true);
return pg;
}Catch(Exception e){
return null;
}
}
Javascript :
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
sforce.apex.execute("QuoteGroupCreateController","StartSync",{});
Can anybody tell what i am doing wrong in this ?
