0

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.

0

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.

https://salesforce.stackexchange.com/a/101049/19118

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/system_fields.htm

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 Tosovsky Jan 13 '17 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.