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
EscTeamEscTeam 

Adding case comments 'as' the self service portal user

Hi,

I'm building a portal (webapp) for our internal users to be able to log cases and then add case comments. The portal serves as a front end to SFDC's cases.  There are several reasons we're not using the built-in self service portal.

Our internal users (who will be using this portal) are defined as self service portal contacts in SFDC. I would like to be able to have their ID be the CreatedById when they add a case comment. Currently the only way I can find to add a case comment is through a SFDC User ID that has enough priviledges to do so (a NON-self service portal id such as Administrator).

There are two things I've tried:

1. I've tried binding with an Administrator id and then attempted to use the setCreatedById method on the CaseComment object but it appears that the CreatedBy field is always readonly (which begs the question, why is there an api to set it if it can't be set).  My hope is that even bound as an admin I could force the createdbyid to reflect any user I chose to put in the method.

2. I've also tried to first login as the contact and then add the case comment based on that users binding but that gives me the error that a self service portal user isn't authorized to use the API.

Is there a way that I can

 - create cases
-  log case comments
-  attach files

that will reflect the CreatedById of the self service portal user that is doing these actions?

Thanks
Ken
MarkSilberMarkSilber
I believe there is a "hidden" option that Salesforce Support can set for you -- it allows you to override certain audit fields. The primary purpose of this feature is to allow you to import data from other systems -- but it should work in this case. Mark
EscTeamEscTeam
When you say "import" will this apply to api interactions as well or actually the import method?

I'm trying to set the createdbyid via the api specfiically.  Sorry, just wanted to be sure what you are suggesting applies to the api as well.

Thanks
MarkSilberMarkSilber

Our loads were via the Data Loader, which also leverages the API. I did a quick search through the online help and found this explanation of the audit feature. Based on the description below, it looks like this should solve your problem.

Approval for turning on Insertable System Audit Fields
It is possible to set system fields through the 7.0 (or higher) API. When migrating data from an external system, the 7.0 API lets customers set the CreatedBy, CreatedDate, LastModifiedByID, LastModifiedDate, and a number of other fields on most objects that were previously read-only for most objects. By setting these fields, records will appear to have been created at their original created time from your old system. For example, you could use the data loader to insert values into these system modifiable audit fields on record creation.

The objects that you can edit these fields on are:

- Account
- Opportunity
- Contact
- Lead
- Case
- Task
- Event

In general, salesforce.com recommends that this feature only be enabled while you are doing data migration. In certain cases (such as routinely copying new data from an external system to salesforce.com) this can be enabled permanently.

Administrators considering enabling this functionality should note that once this feature is turned on, system fields are mutable by System Administrators. This can have an effect on the integrity of your data. Additionally, the fields no longer have the same value in an audit.

If you are interested in turning on this feature, email a request to Salesforce Support with the date you would like this feature enabled until.
 

EscTeamEscTeam
Awesome, thanks a bunch.

mervmerv
Hi, Can you tell me if this worked for you? We are having the same issue and right now it's a show stopper for our project.
pablocruzpablocruz

Hi, I'm a dev working on migrating our data to another version of SF.  I need to find a way to modify the CreatedDate system field in accounts, leads, opps, and contacts.  I cannot locate how to enable the feature to override this date field in the SF UI.

Can you point me, please?

Thx,

Paul

MarkSilberMarkSilber
You can't override the fields directly in the UI -- it has to be through the API (or a tool / process that uses the API, like Data Loader). You will need to contact Salesforce Support to enable this feature.
BrianO'HalloranBrianO'Halloran
I too am looking to write to the createBy field within the case comment field. I have contacted SForce support about being able to do this but they indicated that it can not be done with on the Case Comment object. If this is the case how did others get around this problem, and how do you import data from other systems without setting this field. Lastely, the old self service portal can do it, so it can be done, but just not accessable via the API.

Please let me know how others have got around this issue.

Thanks
Brian


Message Edited by BrianO'Halloran on 01-04-2008 06:47 AM