We have an issue since we moved to a data quality tool. When you create a record in Salesforce you get the logged in user as the one that created and last modified the record.

With data quality tool the purpose is that before creation we are redirected to a VF page that does a check in a global non salesforce database for the record and then if needed creates the record in Salesforce using an API user. This has as a big disadvantage that the created and last modified user is always the api user.

Now i thought of using the userInfo.getUserId() in a trigger to add that user data in to a custom lookup so we still see who the actual user was that created the record. Now it seems that it is still the api user that is in those custom fields even when i am logged in.

Is there a workaround for this so that we can provide somewhere the physically logged in user instead of the api user?

Or do we need to tell the provider that he needs to change his code so oAuth is used (not the easiest option i pressume).

Thank you for your thoughts


  • What is this Data Quality Tool that you are referring to? Is it something you have built or some commercial application? – AslamK Jan 14 '16 at 9:36
  • 1
    It seems a strange authentication pattern that this tool is using. If you're logged in anyway, why aren't they just using you and your session? – pchittum Jan 14 '16 at 9:57
  • I would recommend user to create record first, and then remove it by api user. That what was done in some cases in our company earlier – kurunve Jan 14 '16 at 10:08
  • Hi thanks for the comment. It is a commercial tool not on appexchange. They provide Account lookup for the Netherlands in a local database and they write back to Salesforce with an api user. As a logged in user you open up a html page on their servers where you can create a new account. They search inside their own database and inside the salesforce org. When not found in the salesforce org but found in their database they create the record via api. So create by is the api user. – Sven Delporte Jan 15 '16 at 7:29

I think instead of using API user for creation of record, you should use SessionId of current logged in user(insted of token in api callout) . This will make sure that you get current user as created by and last modified by. Let me know if this works.

  • In case if that is third api enterprise level custom tool, that should be always connected to salesforce -- it is not a solution I think. – kurunve Jan 14 '16 at 10:09

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.