• nxdev
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi,
I was wondering if it is possible for a self-service user to login to the API?  We have written our own frontend for Case management on our website, but we would like the cases to be submitted as the user.  I can't seem to change the "CreatedByUserId" field, so somehow I need to submit the case as that user.  Does anyone have any thoughts?

Thanks,
Jon
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);