Skip to main content
Hi All ,

Hi,

I am trying to list all case created to particular account here the parameter is the CaseId, below the apex code,

below the code,

RestResource(urlMapping='/NotesListView/*')

global with sharing class NotesListView{

@HttpGet

    global static List<Note> getNoteById() {

       RestRequest req = RestContext.request;

        RestResponse res = RestContext.response;

        String Id= req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);

          List<Note> result = [Select Id, Title, Body from Note where ParentId= :Id];

        return result;

    }

}

Where I Pass CaseId in ParentId.
6 respuestas
  1. 18 jul 2018, 12:01
    As per the new enhancement, the object is ContentDocumentLink ,ContentDocument,ContentVersion for notes query. Please try below to get the correct result.

    ---------------------

    RestResource(urlMapping='/NotesListView/*')

    global with sharing class NotesListView{

    @HttpGet

        global static List<ContentDocumentLink> getNoteById() {

           RestRequest req = RestContext.request;

            RestResponse res = RestContext.response;

            String Id= req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);

            List<ContentDocumentLink> result = [SELECT ContentDocumentId,ContentDocument.Title FROM ContentDocumentLink WHERE LinkedEntityId=:Id];

            return result;

        }

    }

    --------------------------------

    Please mark it best if it helps you. Thanks.
0/9000