3

I am wanting to select the CaseComment CreatorName field as a part of a custom CaseComments VF page:

[SELECT Id, CommentBody, CreatorName
                        FROM CaseComment 
                        WHERE ParentId IN :relatedCaseIds]

but am getting the following error:

No such column 'CreatorName' on entity 'CaseComment'.

the docs for the CaseComment.CreatorName field says:

Name of the user who posted the question or reply. Only the first name of internal users (agents) appears to portal users in the feed. Chatter Answers must be enabled to view this field. This field is available in API version 26.0 and later.

I have checked and the VF page is using version 26.0.

I am selecting the CommentBody with no difficulties. Does anyone know why I might be getting this error?

Thanks

3 Answers 3

7

There is no field called CreatorName.

There is a createdbyId something that's not shown on the field list is CreatedBy.Username or CreatedBy.Name depending on what you would like to see.

[SELECT CreatedById, CreatedBy.UserName, CreatedBy.Name FROM CaseComment]

7
  • Thanks a lot for this. Do you know why CreatorName would be on this API page for CaseComment, then? Also, interested in how you know there is a createdbyid if it is not in a field list. How did you find out about this? Cheers.
    – Joe
    Commented Sep 26, 2012 at 13:49
  • Missing link that I should have referenced: salesforce.com/us/developer/docs/api/Content/…
    – Joe
    Commented Sep 26, 2012 at 13:51
  • Also, do you know how to access the creation datetime?
    – Joe
    Commented Sep 26, 2012 at 13:52
  • Ah. CreatedById is a System field that all (or most) objects are assigned at the time of creation. As shown in the following link: salesforce.com/us/developer/docs/api/Content/system_fields.htm
    – Joe
    Commented Sep 26, 2012 at 14:16
  • 1
    I used the Workbench to get the field list. The Salesforce IDE also can work. You'll see CreatedById is the name of the field. You won't find CreatedBy.Name listed. That's actually a relationship query which you can find info on here: salesforce.com/us/developer/docs/api/Content/… Workbench link: workbench.developerforce.com Commented Sep 26, 2012 at 14:34
2

Actually there is a CreatorName field on Case Comments. This is very new though and only available in the API v26. It is also available if you have Chatter Answers enabled in the org (which requires at least one license to be provisioned).

CreatorName has been added to:

  • Question object
  • Reply object
  • Case object
  • CaseComment object

This allows you to have the name of the creator without having to query the user table. For portal users, only the first name of internal users will be visible though in the CreatorName.

Also we have added more fancy things to go along on the same 4 objects:

  • CreatorFullPhotoUrl
  • CreatorSmallPhotoUrl

which contain the photo of the URL to the photo of the creator. You can leverage this to build your own Q&A and Case Management.

0

Enable chatter answers. Customize > Chatter Answers > Settings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .