You need to sign in to do that
Don't have an account?
ManojKumar Muthu
Apex code to view list of comments (Custom object) related to case
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.
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.
@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;
}
}
All Answers
@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;
}
}