<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>user | Taha Syed | Salesforce</title>
<atom:link href="https://www.syedtaha.com/tag/user/feed/" rel="self" type="application/rss+xml" /><link>https://www.syedtaha.com</link>
<description>Taha Syed &#124; Sales to Salesforce &#124; Dissecting and Defining the Rationale..</description>
<lastBuildDate>Wed, 12 Sep 2018 15:09:13 +0000</lastBuildDate>
<language>en-US</language>
<sy:updatePeriod>
hourly	</sy:updatePeriod>
<sy:updateFrequency>
1	</sy:updateFrequency>
<generator>https://wordpress.org/?v=6.9.4</generator>
<item><title>Manually Setup a Users Password in Salesforce</title><link>https://www.syedtaha.com/salesforce-admin-hacks/manually-setup-a-users-password-in-salesforce/1001/</link>
<comments>https://www.syedtaha.com/salesforce-admin-hacks/manually-setup-a-users-password-in-salesforce/1001/#comments</comments>
<dc:creator><![CDATA[Taha Syed]]></dc:creator>
<pubDate>Fri, 17 Aug 2018 17:14:07 +0000</pubDate>
<category><![CDATA[Salesforce Admin Hacks]]></category>
<category><![CDATA[admin hacks]]></category>
<category><![CDATA[developer console]]></category>
<category><![CDATA[password]]></category>
<category><![CDATA[salesforce]]></category>
<category><![CDATA[setup password manually]]></category>
<category><![CDATA[system.setpassword]]></category>
<category><![CDATA[user]]></category>
<category><![CDATA[users password]]></category>
<category><![CDATA[workbench]]></category>
<guid
isPermaLink="false">http://www.syedtaha.com/?p=1001</guid><description><![CDATA[<p>Manually Setup a Users Password in Salesforce using the Developer Console or the Workbench. Here's a step by step method to setup the users password manually. Pro tip includes creating a user interface to setup new passwords manually.</p>
The post <a
href="https://www.syedtaha.com/salesforce-admin-hacks/manually-setup-a-users-password-in-salesforce/1001/">Manually Setup a Users Password in Salesforce</a> first appeared on <a
href="https://www.syedtaha.com">Taha Syed | Salesforce</a>.]]></description>
<content:encoded><![CDATA[<h1>Manually Setup a User&#8217;s Password in Salesforce using Developer Console or the Workbench.</h1><p>There are times when an Administrator needs to <strong>manually setup a users password in Salesforce. </strong>Salesforce Administrator&#8217;s can <strong>reset</strong> a User&#8217;s password from the User record detail page but Salesforce user interface doesn&#8217;t allow an Administrator to setup a specific password. Here is an Awesome Admin Hack to achieved this using the Developer Console or the Workbench.</p><p>Let&#8217;s discuss each method step by step.</p><h2>Manually Setup a User&#8217;s Password in Salesforce Using the Developer Console.</h2><p>Step 1. Get the User&#8217;s Id from the URL bar on the User&#8217;s record detail page.</p><figure
id="attachment_1002" aria-describedby="caption-attachment-1002" style="width: 674px" class="wp-caption alignnone"><img
fetchpriority="high" decoding="async" class="size-full wp-image-1002" src="http://www.syedtaha.com/wp-content/uploads/2018/08/get-Salesforce-User-ID.png" alt="get Salesforce User ID" width="674" height="328" srcset="https://www.syedtaha.com/wp-content/uploads/2018/08/get-Salesforce-User-ID.png 674w, https://www.syedtaha.com/wp-content/uploads/2018/08/get-Salesforce-User-ID-300x146.png 300w" sizes="(max-width: 674px) 100vw, 674px" /><figcaption
id="caption-attachment-1002" class="wp-caption-text">get Salesforce User ID</figcaption></figure><p>Step 2. Open Developer Console</p><p>Step 3. Open the Execute Anonymous Window from Debug &gt;&gt; Open Execute Anonymous Window OR using the shortcut Ctrl + E</p><p>Step 4. Enter the following Apex code. Replace the UserId and Password with the actual values we need.</p><pre class="lang:default decode:true ">System.SetPassword('UserId','Password'); //Replace the UserId and Password</pre><p>Step 5. Click Execute</p><p>We successfully manually setup the User&#8217;s password using the developer console and an email with the new security token will is emailed to the User.</p><p>&nbsp;</p><h2>Manually Setup a User&#8217;s Password in Salesforce Using Workbench.</h2><ol><li>Visit <a
href="https://workbench.developerforce.com/login.php" target="_blank" rel="noopener">Workbench</a> (<a
href="https://workbench.developerforce.com/login.php" target="_blank" rel="noopener">https://workbench.developerforce.com/login.php</a>) and Login using your Salesforce credentials.</li><li>Navigate to Utilities &gt;&gt; <a
href="https://workbench.developerforce.com/pwdMgmt.php" target="_blank" rel="noopener">Password Management</a></li><li>Enter the User&#8217;s Id and the New Password</li><li>Click on Change Password</li></ol><p>We successfully manually setup the User&#8217;s password using Workbench and an email with the new security token will is emailed to the User.</p><p>&nbsp;</p><h2>Pro Tip: Creating a User Interface to manually setup a User&#8217;s password in Salesforce.</h2><p>Step 1. Create a New Text Field on the User Object and Name it Password__c</p><p>Step 2. Create the following trigger on the User object</p><pre class="lang:default decode:true ">trigger setPassword on User (before update) {
    for (User u:Trigger.New) {
        User oldUser = Trigger.OldMap.get(u.id);
        If ((u.Password__c != null) &amp;&amp; (oldUser.Password__c != u.Password__c)) {
            System.SetPassword(u.id,u.password__c);
            //Uncomment below line to clear password field
            //u.Password__c = null;
        }    
    }
}</pre><p>Note: Use validation rules on Password__c to only accept passwords that align with your organization&#8217;s password policies.</p><p>Here&#8217;s how the trigger looks in the developer console (image)</p><figure
id="attachment_1020" aria-describedby="caption-attachment-1020" style="width: 945px" class="wp-caption alignnone"><img
decoding="async" class="wp-image-1020 size-full" src="http://www.syedtaha.com/wp-content/uploads/2018/08/manually-setup-a-users-password-in-Salesforce.png" alt="manually setup a users password in Salesforce" width="945" height="449" srcset="https://www.syedtaha.com/wp-content/uploads/2018/08/manually-setup-a-users-password-in-Salesforce.png 945w, https://www.syedtaha.com/wp-content/uploads/2018/08/manually-setup-a-users-password-in-Salesforce-300x143.png 300w, https://www.syedtaha.com/wp-content/uploads/2018/08/manually-setup-a-users-password-in-Salesforce-768x365.png 768w" sizes="(max-width: 945px) 100vw, 945px" /><figcaption
id="caption-attachment-1020" class="wp-caption-text">Manually setup a users password in Salesforce</figcaption></figure><p>Step 3. Now visit the User&#8217;s record detail page and enter the new password in the <strong>Password</strong> field that we created and click Save.</p><p>The User&#8217;s password will be changed and an email with the new security token will be emailed to the User.</p><p>&nbsp;</p><p>Update: To send the new password to the user by email, the trigger will be:</p><pre class="lang:default decode:true ">trigger CPTsetPassword on User (before update) {
    List &lt;String&gt; toAddresses = New List &lt;String&gt;();
    for (User u:Trigger.New) {
        User oldUser = Trigger.OldMap.get(u.id);
        If ((u.Password__c != null) &amp;&amp; (oldUser.Password__c != u.Password__c)) {
            System.SetPassword(u.id,u.password__c);
            toAddresses.add(u.Email);
            //Uncomment below line to clear password field after reset
            //u.Password__c = null;   
            
            //Sending the users new password by email
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setToAddresses(toAddresses);
            mail.setSubject('Salesforce Password Reset');
            mail.setPlaintextBody('Your password was reset by the Administrator and the new Password is ' + u.Password__c);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});         
        }    
    } 
}</pre><p>&nbsp;</p>The post <a
href="https://www.syedtaha.com/salesforce-admin-hacks/manually-setup-a-users-password-in-salesforce/1001/">Manually Setup a Users Password in Salesforce</a> first appeared on <a
href="https://www.syedtaha.com">Taha Syed | Salesforce</a>.]]></content:encoded>
<wfw:commentRss>https://www.syedtaha.com/salesforce-admin-hacks/manually-setup-a-users-password-in-salesforce/1001/feed/</wfw:commentRss>
<slash:comments>2</slash:comments>
</item>
</channel>
</rss>