function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Harsh Dhruv 10Harsh Dhruv 10 

OnClick JavaScript Error for sync code

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 :

User-added image


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 ?