• raviteja p 38
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I am creating an enhanced note under Contact and adding the same note to another custom object called Custom Note while creating the note itself.

I have written After Insert trigger on ContentVersion where ContentDocument.FileType == 'SNOTE'. The issue here is that on quering ContentDocumentLink in trigger, the query is returning only one record where LinkedEntity.Type is User whereas using the same query in developer console, its returning 3 records, 1 for Contact, 1 for User and 1 for Custom object (Custom Note)


here is the code:

public void createTasksforEnhancedNotes(List<ContentVersion> notes){
    
    Set<Id> noteIdSet = new Set<Id>();
    for(ContentVersion each : notes){
        noteIdSet.add(each.ContentDocument.Id);
    }
    
    if(noteIdSet != null && !noteIdSet.isEmpty()){
        List<ContentDocumentLink> contentLinkList = [SELECT ContentDocument.Title, ContentDocumentId, LinkedEntityId FROM ContentDocumentLink 
                                                     WHERE ContentDocumentId IN :noteIdSet];
        
    }            
            
}


Please help and explain why the query is returning different result in trigger and developer console
I am getting the below error when i am trying to deploy the code from locale tot he scratch org

This error comes when i created a custom label in the Lightning Web Component.
Labels should have a section and a name: ProgramOverview