function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
J_HinderJ_Hinder 

Case Comment Question

I'm getting this error when I try to create a Case Comment via the API

Unable to create/update fields: CreatedById. Please check the security settings of this field and verify that it is read/write for your profile.:

I'm handling the portion that logs into Salesforce with an Admin user, but trying provide functionality to allow other users that can successfully login to the selfservice user portion to add comments. So the CreatedById that I'm sending is that of the self service user, not the person that I've used for the login/session stuff.

Will I need to try to login and set the session for a self-service user or something?

Please advise,

Joe
SuperfellSuperfell
In general the audit fields Created/LastUpdated/SystemModStamp, are all managed by the service, you can't set the values yourself.

There is a feature just released in Winter'06 that lets you write to these fields for certain objects (to aid in migrated data into salesforce) but i'm pretty certain that case comments is not one of those objects.
J_HinderJ_Hinder
Thanks for the quick reply,

So it looks like I'll need to create a custom field for Self Service User Ids that come in from self-service users in my client's customer portal, right? I (foolishly) tried to log in with a self service user as well. Figured it was worth a shot....

Here's what I'm trying to do:

Dim strUserName = (AdminUserName)
Dim strPassword = (AdminPassword)

lr = Sforce_Service.login(strUserName, strPassword)

Sforce_Service.Url = lr.serverUrl
Sforce_Service.SessionHeaderValue = New Sforce_External_Support.SessionHeader
Sforce_Service.SessionHeaderValue.sessionId = lr.sessionId

Dim com(1) As Sforce_External_Support.sObject
Dim comment(4) As System.Xml.XmlElement

comment(0) = GetNewXmlElement("ParentId", strCase_Id)
comment(1) = GetNewXmlElement("CommentBody", strComment)
comment(2) = GetNewXmlElement("IsPublished", "True")
comment(3) = GetNewXmlElement("CreatedById", (SelfServiceUserId))


Dim at As New Sforce_External_Support.sObject
at.type = "CaseComment"
at.Any = comment
com(1) = at
bildbild
I am having the same problem setting CreatedById.  This is actually quite a pain, since we are making our own self-service support portal, and want people to be able to add comments to their Cases, and for their authorship to be reflected in the CreatedById.  As with several other missing or broken features, I hope this is remedied in the next version.
bildbild
Is there any way to add a custom field to CaseComment?  That way, we could put the ID of the contact who is really creating the comment in THERE, and display it in our custom app.  I cannot find a way to do it under Setup, and according to other threads here, one cannot use the API to make schema changes.

Any thoughts?
b