You need to sign in to do that
Don't have an account?
chikku
How to fetch data form apex class to JavaScript?
I have Loan object with three fields and look up relation with application in application object also i has same three fields ,now i need to fetch the data from apex class
This my apex code:
This my js code:
i used this code only ,but it doesnt worked anything ineed to chnage?
This my apex code:
public static List <SObject> chart(Id id){ List<sObject> entities= [SELECT Total_Jobs_Created__c,Total_Jobs_Lost__c,Total_Jobs_Maintained__c, Application__r.Total_Jobs_Created__c,Application__r.Total_Jobs_Lost__c,Application__r.Total_Jobs_Maintained__c FROM Loan__c WHERE Id=:id]; return entities; }
This my js code:
loanImpactjobs() { console.log("sai") this.loading=true; let loanjobs={'sobjectType':'Loan__c'}; chart({id:this.recordId }).then(data=>{ if(data!==''&& data!== 'null' && data!=='undefined'){ var jobs=JSON.parse(this.details); this.LCreatedjobsValue=jobs["Total_Jobs_Created__c"]; console.log(this.LMaintainedjobsValue) this.LLostjobsValue=jobs["Total_Jobs_Lost__c"]; console.log(this.LCreatedjobsValue); this.LMaintainedjobsValue=jobs["Total_Jobs_Maintained__c"]; console.log(this.LLostjobsValue); } } ).catch(error => { this.errorMessage(error); }); }
i used this code only ,but it doesnt worked anything ineed to chnage?
No my requirment is to apex with js,i dont use vs page
All Answers
Can you take the following VF remoting example as a reference?
Apex Code
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
No my requirment is to apex with js,i dont use vs page