You need to sign in to do that
Don't have an account?
Harsh 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 :
Apex Method :
Javascript :
Can anybody tell what i am doing wrong in this ?
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 ?
Define your class as global : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_and_ajax.htm
Regards,