• cibi saran
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies
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:
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?
This my code i used(anything i need to modify,please let me know).
import { LightningElement, track, api,wire } from 'lwc';
import { getRecord,getFieldValue  } from 'lightning/uiRecordApi';
@track recType; 
@api recordId;
@track LjobsValue;
@track CjobsValue;
@track MjobsValue;
@wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })
    wiredRecord({data,error}) {
       if (data) { 
       var result = JSON.parse(JSON.stringify(data)); 
       this.recType=result.recordTypeId;
       this.LjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Lost__c');
       this.MjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Maintained__c');
       this.CjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Created__c');
       }
       else{
         this.error=error;  
         console.log(error);
       }
   }
i used this code it throws error in console

this cause error:User-added image
I have error 404  message while opening the trailhead playground 1 it showing 404 error past 1 week it showing same error ..there is any resolved solution
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:
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?
This my code i used(anything i need to modify,please let me know).
import { LightningElement, track, api,wire } from 'lwc';
import { getRecord,getFieldValue  } from 'lightning/uiRecordApi';
@track recType; 
@api recordId;
@track LjobsValue;
@track CjobsValue;
@track MjobsValue;
@wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })
    wiredRecord({data,error}) {
       if (data) { 
       var result = JSON.parse(JSON.stringify(data)); 
       this.recType=result.recordTypeId;
       this.LjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Lost__c');
       this.MjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Maintained__c');
       this.CjobsValue=getFieldValue(data,'Loan__c.Total_Jobs_Created__c');
       }
       else{
         this.error=error;  
         console.log(error);
       }
   }
i used this code it throws error in console

this cause error:User-added image