0

I don't believe this is possible other then doing a nested query but I wanted to double check with everyone in case I was missing the boat.

SELECT Id, CommentBody, CreatedDate, ParentId, CreatedById FROM CaseComments WHERE AccountId = :strAccountId ORDER BY ParentId, CreatedDate DESC

AccountId is obviously not a field on CaseComments so I can not do this. How would I walk CaseComments back to Account?

3

You can do something like the following:

SELECT Id, CommentBody, CreatedDate, ParentId, Parent.AccountId FROM CaseComment

Where Parent.AccountId would give you the AccountId from the Case.

1
  • That will do a better job :) – Carlos Naranjo Apr 21 '17 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.