You need to sign in to do that
Don't have an account?
pitaboy
CaseComment Object questions
Hi,
I have a few questions regarding the CaseComment object.
1. How do you make a new CaseComment object public/private using the API 6.0 and C#? Is it using the IsPublished() method call? I've tried using it and the CaseComment object is still created as private. Do I need to create the CaseComment object then use 'update' to make the CaseComment private/public?
2. I know you cannot set/modify the CreatedBy property. However, I need to find a way to track who created the comment (i.e. If it was a self-service user or an internal user.) and I'm not sure how to go about it. As far as I know, the CaseComment object is not customizable, so I assume adding a field/property to the CaseComment is not possible.
Thanks in advance.
CaseComment CommentObject = new CaseComment();
CommentObject.ParentId = CaseId;
CommentObject.CommentBody = Comment.Text;
CommentObject.IsPublished = true;
// Create service object for sforce
SforceService SFService = new SforceService();
// Invoke the login call and save results in LoginResult
LoginResult lResult = SFService.login(usr,pwd);
// Reset the SOAP endpoint to the returned server URL
SFService.Url = lResult.serverUrl;
// Create a new session header
// Add the session ID returned from the login
SFService.SessionHeaderValue = new SessionHeader();
SFService.SessionHeaderValue.sessionId = lResult.sessionId;
sObject[] sObjectArray = new sObject[] {CommentObject};
SaveResult[] saveResults = SFService.create(sObjectArray);
I have a few questions regarding the CaseComment object.
1. How do you make a new CaseComment object public/private using the API 6.0 and C#? Is it using the IsPublished() method call? I've tried using it and the CaseComment object is still created as private. Do I need to create the CaseComment object then use 'update' to make the CaseComment private/public?
2. I know you cannot set/modify the CreatedBy property. However, I need to find a way to track who created the comment (i.e. If it was a self-service user or an internal user.) and I'm not sure how to go about it. As far as I know, the CaseComment object is not customizable, so I assume adding a field/property to the CaseComment is not possible.
Thanks in advance.
CaseComment CommentObject = new CaseComment();
CommentObject.ParentId = CaseId;
CommentObject.CommentBody = Comment.Text;
CommentObject.IsPublished = true;
// Create service object for sforce
SforceService SFService = new SforceService();
// Invoke the login call and save results in LoginResult
LoginResult lResult = SFService.login(usr,pwd);
// Reset the SOAP endpoint to the returned server URL
SFService.Url = lResult.serverUrl;
// Create a new session header
// Add the session ID returned from the login
SFService.SessionHeaderValue = new SessionHeader();
SFService.SessionHeaderValue.sessionId = lResult.sessionId;
sObject[] sObjectArray = new sObject[] {CommentObject};
SaveResult[] saveResults = SFService.create(sObjectArray);
CommentObject.IsPublishedSpecified = true;
otherwise .NET doesn't send that element over the wire.
As for my 2nd question, is their any way to find who wrote a comment? Either by creating a new field for the CaseComment or by any another means? Are their plans to allow such things in future API releases?
Thanks
// Invoke the login call and save results in LoginResult
LoginResult lr = sfdc.login(usr,pwd);
// Reset the SOAP endpoint to the returned server URL
sfdc.Url = lr.serverUrl;
// Create a new session header
// Add the session ID returned from the login
sfdc.SessionHeaderValue = new SessionHeader();
sfdc.SessionHeaderValue.sessionId = lr.sessionId;
An upcoming feature allows API users to override some of the audit fields for loading data, although i don't know if casecomment is included in the set of objects that'll be supported.
#1----------------------------------------------------------------------------------------------------------------
Doesn't the createdBy field point to the self service user that created the comment ?
Cheers
Simon
----------------------------------------------------------------------------------------------------------------
#2----------------------------------------------------------------------------------------------------------------
SelfService Users can't use the API.
An upcoming feature allows API users to override some of the audit fields for loading data, although i don't know if casecomment is included in the set of objects that'll be supported.
Cheers
Simon
----------------------------------------------------------------------------------------------------------------
At the point you were writing Comment #1, what was the suggestion you were thinking?
Is there "ANY" way to make the selfservice user's id to be the createdby of a casecomment?