You need to sign in to do that
Don't have an account?
Abhishek Sharma 527
No Result from LWC Function Calling
I'm calling getLognotes() on click of button but it's showing nothing in console. I tried to call it from connected callback but when I do that the whole page gets disappear, so I tried button click approach but no go. Even 'Hi' is not getting printed so I think on I'm not even getting inside function.
import { LightningElement, track,api, wire } from 'lwc'; import getContentNote from '@salesforce/apex/TBT_SupervisorLog.getContentNote'; export default class tBT_SessionGuideline extends LightningElement { // connectedCallback(){ // this._getLogNotes(); // this not working // } _getLogNotes(){ getLogNotes(action).then(res => { this.getContentNote = res; console.log('hi'); console.log("content notes result", this.getContentNote); }).catch((error)=>{ console.error("content notes error " ,JSON.stringify(error)); }) } *My apex class* public with sharing class TBT_SupervisorLog { @AuraEnabled(Cacheable=true) public static List<ContentNote> getContentNote(){ Set<Id> contactIds = new Set<Id>(); contactIds.add('0030100000ABCD'); Set<Id> contentLinkIds = new Set<Id>(); for(ContentDocumentLink conLink : [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN :contactIds]){ contentLinkIds.add(conLink.ContentDocumentId); } List<ContentNote> NoteList = [select id, ContentModifiedDate, LastModifiedBy.name from ContentNote where Id IN : contentLinkIds ]; System.debug(NoteList); return NoteList; } }I checked in debug log it's fetching result from class.Please if someone could guide.
There are some issues with your code , Can you try with below :
If the above code helps , please mark this as Best Answer.
Thank you.