Authored by Zishan Razzaq
Showing posts with label Apex Code. Show all posts
Showing posts with label Apex Code. Show all posts

Thursday, February 23, 2012

Change Password via Developer Console in Salesforce without resetting password

Scenario:
      We need to reset a password or change the password on an user utilizing a 3rd party app in salesforce. This user is there for the app only and not really a physical user in the instance. The email for this user is a person who has left the company or is on vacation but you need the app to work.

Solution:
    You can do this 2 ways:
  1. Change the Email of the user in question
  2. Click on Generate Password and click save.
But lets say you can not change the Email of the user because you should not be the owner of the app or you are not part of the app as an admin. Here is where you change using Developer Console.

Go to Setup and Drop it down to Developer Console or sometimes called the System Log




Within the "Logs" tab you will see a button called "Execute".


Click on the text box or white space next to it.

It shall open up another window which is titled "Enter Apex Code"

Place in the following SOQL query:
User usr = [select Id from User where username='appuser@myzc.com'];
System.setPassword(usr.Id,'welcome1234');

Then click on Execute.
It should bring up a success window and you should be good to go.
Now you may need to log in and make sure everything is ok.

Hope this helps... I am not responsible for anyone utilizing this method... It can be a risk... I would check before you do this task.
Thanks
Zishan R.


Watch Me Fight 
Join My Facebook on Cage Assassin Fight Gear 
Like my fan page Cage Assassin Fight Gear 

Thursday, November 27, 2008

Understanding a Trigger in Salesforce.com

Hi again:
This will be the first of many lessons on Triggers. But before I start writing triggers in salesforce.com, I need to explain triggers and how they work. One needs to understand before anything. So lets start.
  1. What is a Trigger?
"A Trigger is a block of Apex Code that executes in response to a particular type of change in a record's data." from the Force.com Developer Guide Page 336

  • What does the above definition mean in simple English. Basically a trigger is an event that fires off when a record is changed.
  • by changed I mean, you can:
    • Update a Record - Updating an existing record.
    • Insert Record - Inserting a new record like a new Account or Contact.
    • Delete Record - before the record deletes make sure everything is valid.
  • These three Actions we call (Update, Insert, Delete) are the main functions of a trigger. Basically which one will use a trigger for.
  • Also one can use a trigger as a controller combine with Visualforce or calling a web service API.
  • People have asked the question "How can I override the Save button in Force.com" Plain and simple way is to write a trigger. Why or How?
  • Simple, when you create or update a record the only way your new information weather you added information to an existing record or changed it or you added a new record, one would have to click SAVE to place the information into the database.
  • By clicking Save if you have a trigger on that Object then you can fire it off, thus overriding the save button. It will save and do the commands you wrote in the trigger itself.
  • Also, triggers must be written in Sandbox and then deploy to server via eclipse tool.
  • It must pass the standard requirement of 75% in sandbox before deploying into production.


I hope this cleared many questions about understanding a trigger. My next post will be on writing a trigger and implementing it.
Thanks
View my Other Blogs:
VisualForce Made Easy

Salesforce Data Migration Made Easy