Pages

Sunday, December 29, 2013

Salesforce: Dashboard with four-column table

Table is one of the component type available for dashboard. By default, tables show only two columns of data, but you can modify it up to 4 columns of data.

You can also personalize the table and show users’ Chatter photos as long as the table doesn’t have more than 20 rows.

Here are few items to note in customizing table columns:
  1. Make sure the source report is in matrix or summary format 
  2. Make sure the source report contains a chart
  3. Fields available to use in the table depends on the fields picked in the chart of source report 
  4. The chart in source report must contain groupings and at least one summary
  5. The first grouping in the report (not in chart) becomes the first column of the table.
  6. Use vertical bar chart in the report to make more fields available for the table.
  7. Click Customize table in table to add more columns (default only 2)

Sample 1



Sample 2



Limitations:
1. Customized tables will allow null values in the results. The Default two-column tables do not.
2. You can have the following combinations:
     2 grouped fields and 1 number
     2 grouped fields and 2 numbers
     1 grouped field and 2 numbers
     1 grouped field and 3 numbers. (Although we can do one grouping and three summaries, not all the summaries may be added. We cannot set different data type.)
     Not have 3 grouped fields and 1 number
3. Can’t sort by 2nd groupings


Reference:


Saturday, December 28, 2013

Salesforce: Lead Conversion Validation Rule

We blog on lead field conversion mapping sometimes back this year. In this blog, we would like to discuss how to run Validation Rules on Lead conversion process, this mean to block Lead conversion if not satisfy any rules. Few items to check:

1. Require Validation for Converted Leads
Earlier this option is called as Enforce Validation and Triggers from Lead Convert. Make sure this setting is enabled, otherwise Validation Rule on Lead conversion will be ignored. Go to Setup - Customize - Leads - Settings, enable Require Validation for Converted Leads. If you do not see this option, log a case with Salesforce support to get this option enable for you.

When this checkbox selected, it will check all validation rules in related objects of Lead conversion, including: Lead, Account, Contact and Opportunity (if Do not create a new opportunity upon conversion is not checked).



2. Set Validation Rule in Lead object
Use Case: company would like to stop lead conversion when Title is blank.
Here we go:
  • Create a validation rule in Lead using formula IsConverted
  • Make sure the rule is Active, many people forget to activate it and spend a lot of times before realize it is not active.


3. Set Validation Rule in target object
Target object here is Account, Contact and Opportunity. 
Use Case: company would like to block Account without website.
Although it is possible to create the rule in Lead, but if the validation rule in Account level, even you skip it in Lead object validation rule, validation rule in Account will take care for this.


Note:
When you have validation rule in both target, example: Account and Lead object with checking IsConverted, Account validation rule will kick-in before Lead validation rule with checking IsConverted field. This make sense because Salesforce will create / update Account before update Lead with IsConverted = True.


Reference:


Friday, December 27, 2013

Salesforce: NO Email Alert action for Task & Event workflow


THIS IS DELIVERED by SPRING '16 release


Normally, in Salesforce workflow, we can add action:
  • Create Task
  • Send Email Alert
  • Field Update
  • Send Outbound Message
But, if you realize (until release Summer '14 release) for workflow object Event and Task, there is NO Email Alert option for action.

Here is normal action for workflow:























And this screenshot on Event or Task, notice that "New Email Alert" is not there.

















This limitation has aware for quite long time, and someone has posted this in IdeaExchange, you are please to vote from here (currently it have 2670 points for this idea).


Workaround:

1. Create Workflow + New Task action 
This option may not be a nice, it will create another new task just to email user when Workflow on Task or Event triggered. You need to tick Notify Assignee in the task for Workflow.









2. Use AppExchange product - iTools Delegated Tasks Management
This is not a free product - https://appexchange.salesforce.com/listingDetail?listingId=a0N30000001gFJNEA2

3. Write Apex Trigger
Here a sample code for this.




Thursday, December 26, 2013

Update Salesforce using JavaScript AJAX Toolkit

For you who are not from developer background, don't be afraid with the title of this blog, this is not about how to write JavaScript blog. But, using a simple script provided with Ajax Toolkit, you can make use of it for your business needs in Salesforce area.

Use Case:
To change Account Type from Prospect to Customer via a button click, and Customer value itself maybe not a picklist in the account type.

Solution:
Create a custom button in Account object. Here we go:
  1. Navigate to Setup | Customize | Accounts | Buttons, Links, and Actions
  2. Click New Button or Link, select Detail Page Button in Display Type, and in Behavior select Execute JavaScript
  3. Paste script below
  4. Add custom button created to the Account page layout.
  5. Done - simple ?
The script:
 {!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}  
 var AccObj = new sforce.SObject("Account");  
 AccObj.Id = '{!Account.Id}';  
 AccObj.Type = 'Customer';  
 var result = sforce.connection.update([AccObj]);  
 location.reload(true);  




Further tweak, you also can differentiate Customer record type with Prospect record type, so in the script above, add one line to change Account Record Type with Customer Record Type Id, then assign different Page Layout for Customer.

Salesforce Last Login report using Date Value

Last month we wrote a blog of using LAST_WEEK ; LAST_N_DAYS:n ; N_DAYS_AGO:n for SOQL query, it is simple and very powerful to query Salesforce data dynamically.

The same we can implement for report and view. This blog will discuss using Relative Date Value, such as: Yesterday, Today, Tomorrow, This Week, Last Week, etc (for complete value, refer to this Salesforce documentation) in report and how to choose date value to use. We'll use Last n Months versus Last n Days for sample.

Use Case:
VP of IT would like to understand users not login to Salesforce in last 60 days.

Solution:
Using Salesforce report, we can easily create a report, by selecting Users report type (make sure you have admin privileges).




















Add a filter in the report Last Login not equal to LAST 60 DAYS and done. This report will show all users never login + users not login within last 60 days.

If you tweak the filter to Last Login not equal to LAST 2 MONTHS, surprisingly you will get very different result. 

Let us analyze, example today is 26 Dec 2013:
  • Using "not equal to LAST 2 MONTHS", will show users never login + users last login = Dec '13, because last 2 months in this scenario is Oct '13 & Nov '13. 
  • Using "not equal to Last 60 DAYS", will return users never login + users login before 27 Oct '13.
Make sense? Hope this help.


Reference: Understanding Relative Date Values for Filter Criteria


Wednesday, December 18, 2013

Can we sort Salesforce Activity History?

Can we sort Salesforce Activity History? Until Summer '14 release, users cannot sort related list manually (including Activity History), and admin also not able to change the default sort. Activity History is always sorted by Due Date (or ActivityDate in API name) in descending order. It will not consider the created date or modified date in the sort order.

Here is a clear example of Activity History with the same Due Date:



Then, we edit item 2 and 3, we change the Due Date for item 2 to 8/23 and item 3 to 8/25, it will be re-sort with Due Date desc.



Remember Due Date is just a date, no time stamp, so if you have multiple activity history created at the same date, it will not order by created or last modified date time

But, we have a workaround, here we go:

1. Create Custom Button in Task
Setup - Customize - Activities -  Task Buttons, Links, and Actions
Click "New Button or Link", then select Behavior, Content Source and URL as the screenshot below:

/007?id={!Account.Id}&rlid=RelatedHistoryList <-- this is for Account

2. Add Custom Button into Account or Contact or other object page layout
Edit the Layout, scroll to Related Lists and look for Activity History.
Click 'Related List Properties' icon, then click + in Buttons sections, add the button to the right panel

3. Save the Page Layout and Done.
User will see a new button added to 'Activity History' related list. When the user click the button, it will open a new page where the user will be able to sort by any fields.


In Winter '15 release, Salesforce introduce sorting Activity History by Last Modified Date in ascending order, but caused some inconsistency and this has been reverted the changes made in Winter 15.


Page-level ad