How to Set Password for any Salesforce Users?

In our previous blog, we explained how can an admin Set Password for Portal Users Manually. We have received lots of queries and response around it.

Recently Salesforce Users and admin from different firm reached out asking about “How to create password for Internal Users manually” as well.

One of the scenario which has been reported by clients on WHY they want Admin to be able to Create Password for any Salesforce Users is, “Forgetting Security Question’s answer” or not setting “Security Question” at all.

Well! Salesforce has come up with some good news on this front. Lately Salesforce has introduced an API to Create Password for users. It also avoids process of going through Emailing & asking to create Password during first login.


  • User should be a Salesforce Administrator


Steps for Admins

Get User ID

  • Go to Setup -> from Left Sidebar, Go to Users under Manage Users -> Click on the user’s name for which password need to Set / Create / Change.
  • Copy User ID from address bar URL. (Should be a 15 or 18-digit id starting from 005).

Run code snippet

  • Once Salesforce Administrator logs in, Go to Developer Console.
  • Click on “Open Execute Anonymous Window” option under “Debug” menu option on top.
  • Paste following code snippet in pop-up box and click on “Execute”:



    Steps for Developers

    • Similarly, if admin has Developer background and understands Apex Code, then they can run SOQL Query to fetch User IDs and can perform Set Password operation on bulk users.e.g.


  • Note: Since calling System.setPassword consumes 1 DML call, make sure no. of users don’t exceed 150 records, or else it will hit governor limit.





No Comments

Post A Comment