In our custom portal we would like to offer users to create new records in SalesForce database without leaving the portal.

Is it somehow possible to create these items by admin and just specify the creator by passing his SalesForce userID as a parameter of REST-API call?

OAuth is not convenient as it requires login and approval, SSO is too complex to set up and has other drawbacks.


1 Answer 1


What you are trying to achieve is called as "Set Audit Fields upon Record Creation". Salesforce allows that only through data loader. You can read more about that here.



Is there an ugly hack? Yes there is.

Create a Dummy Object with fields u want. In the insert trigger, Use UserName password flow of OAUTH2 to get session id of user you want to use for record creation.

Then using the Rest API create that record with the Session ID you got earlier.

As we cannot do callouts inside a trigger ,make use of Future methods.

  • After enabling this organization wide permission I can act as specified user when records are created. The only thing I miss is ability to alter LastModifiedById on further record modifications. Fortunately it is not a blocker in my scenario. Jan 13, 2017 at 15:07

You must log in to answer this question.

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