Skip to main content
Hi All,

I created a custom object Name "Casecomments" related to Case object and below the Apex code I use to view all "Casecomments" created to a particular case by passing case id,

@RestResource(urlMapping='/CaseComments__c/*')

global with sharing class CaseComments__cListview{

@HttpGet

    global static List<CaseComments__c> getCaseComments__cId() {

       RestRequest req = RestContext.request;

        RestResponse res = RestContext.response;

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

          List<CaseComments__c> result =  [Select id from CaseComments__c where Case__c=:id];

        return result;

    }

I am facing this error,

Error: Compile Error: Invalid character in identifier: CaseComments__cListview at line 2 column 27

can someone help me on this. 

thanks in advance.

 
2 respuestas
  1. 18 jul 2018, 14:39
    Please try below.

    @RestResource(urlMapping='/CaseComments__c/*')

    global with sharing class CaseCommentscListview{

    @HttpGet

        global static List<CaseComments__c> getCaseCommentsId() {

           RestRequest req = RestContext.request;

            RestResponse res = RestContext.response;

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

              List<CaseComments__c> result =  [Select id from CaseComments__c where Case__c=:id];

            return result;

        }

     
0/9000