You need to sign in to do that
Don't have an account?
AwkwardTaco
SOQL and Trigger newbie
I am trying to build a trigger that would send a message to the following users:
1. CreatedBy (Case)
2. LastModifiedBy(Case)
3. CreatedBy(CaseComment)
The query would need to return the following data:
1. CaseComment.CommentBody
2. Email address for the users who need to receive the message
3. Subject Line, ID for the Case
Any suggestions on how to build the query, would be greatly appreciated. I am having some issues trying to get those results.
Thanks.
Try this query,
Case[] cs = [select id, CreatedBy.Email, LastModifiedBy.email, (select CommentBody, createdby.email from CaseComments) from Case];
This is how you can test it,
system.debug('Case is '+cs);
system.debug(' Email id of User who created Case'+cs[0].CreatedBy.Email);
system.debug(' Email body of Case comment'+cs[0].casecomments[0].commentbody);
system.debug('Email id of who created case comment '+cs[0].casecomments[0].createdby.email);
Let me know if it works or if you face any issue.
All Answers
Try this query,
Case[] cs = [select id, CreatedBy.Email, LastModifiedBy.email, (select CommentBody, createdby.email from CaseComments) from Case];
This is how you can test it,
system.debug('Case is '+cs);
system.debug(' Email id of User who created Case'+cs[0].CreatedBy.Email);
system.debug(' Email body of Case comment'+cs[0].casecomments[0].commentbody);
system.debug('Email id of who created case comment '+cs[0].casecomments[0].createdby.email);
Let me know if it works or if you face any issue.
HI Imran,
I need some help on Web service. I am now starting webservices now. Give me the How i start.
I hope you might have gone though the below link and access Getting Started.
Apex Webservices
Myself or anyone on forums will help you further as and when you require.