Wednesday, June 3, 2015

Salesforce Button: Change status of Lead Status field.

Take an example a company uses Salesforce CRM in their organization. A user has come to you with request that he wants a button on Lead record detail page to change Lead Status field to “Closed – Not Converted”. How can this be done using button?
The system administrator needs to create button.

Navigation: Setup > Customize > Leads > Buttons, Links and Actions

New Button or Link

Enter the details
Label: Change Lead Status to Closed – Not Converted.
Name: Auto populated
Description: Change Lead Status to Closed – Not Converted
Display Type: Detail Page Button
Behavior: Execute JavaScript
Content Source: OnClick JavaScript

var objLead = new sforce.SObject('Lead');
objLead.Id = '{!Lead.Id }';
objLead.Status = 'Closed - Not Converted';
var result = sforce.connection.update([objLead]);
alert('The Lead was Updated Successfully');

Click Syntax for errors and save.

When you click save following page is displayed notifying us to add the button to the page layout.

Add Change Lead Status to Closed – Not Converted button to the page layout.

Lead detail page. Lead Status: Working – Contacted. Now I want to change the status to Closed – Not Converted. Click the button.

The Lead was updated successfully.

Lead Status changed to Closed – Not Converted.

Tuesday, June 2, 2015

Profile Comparator for Salesforce

Company uses CRM in their organization and has many profiles. Company has decided to consolidate these profiles. Now the System Administrator has been given the task to consolidate profiles.

The system administrator has to compare all the similar profiles and consolidate them and then give access to all user through permissions sets. An organization can have multiple Apps, Tabs, Record Types, Administrative and General Permissions, Standard and Custom Object Permissions, Apex Class and Visualforce Access. Comparing two profiles is very tedious task. You can’t export object and other permissions in profiles using Data Loader. You can compare the profiles manually or by using Eclipse IDE. But if the System Administrator does not know coding then he has to do the work manually.

But now the system administrator can use Profile Comparator for Salesforce. It’s an application which only works with Google Chrome.  You can also compare profiles between two different instances.  

Click Add to Chrome.

Before using Profile Comparator make sure “Enable Enhanced Profile User Interface” in User Interface is disabled. Profile Comparator does not work when Enhanced Profile User Interface is enabled.

Now let’s compare two profiles.

Open both the profiles in separate tabs in chrome.

In profile comparator we need to select one source profile and other as target profile.

Source Profile: TestSupportProfile

Target Profile: TestSupportProfile0

GO to the tab which is going to be source profile. Then click the Profile Comparator app and then select Source Page.

Similarly select Target page. Below “Select Target Page” button we can see process compete and 36 differences are found. Now let’s review the target page.

We can see Profile Coaching is highlighted in red since it is different on both the profiles. It shows that on target profile Standard Tab Settings is “Tab Hidden”, whereas on Source Profile it is “Default On”

Profile Coaching: Tab Hidden src: Default On

Where “src” stands for source profile.

Similarly for General User Permissions we can see the differences. Hence this apps helps us to compare profile faster.