1. Prevent Duplicate Emails on Lead or Contacts Declaratively

    Do you want a simple solution to prevent duplicate emails on Leads or Contacts in Salesforce? I’ve got one for you! There is standard functionality in Salesforce to set a field as “Unique” (a checkbox in the field definition), thereby preventing duplicate values in a field. However, this option is not available for the standard Lead and Contact Email fields. You can, however, create a hidden custom email field and copy the value from the standard Email field and make the custom field Unique. Here are the steps:

    1. Hit the “New” button on the Lead or Contact Fields screen
    2. Select the Email data type and hit the Next button
    3. Label the field Hidden Email and check the Unique checkbox
    4. Select the desired FLS, hit Next and leave off of page layouts and hit Save
    5. Create a new Workflow Rule on the Lead/Contact object
    6. Set the Workflow Evaluation Criteria to “Evaluate the rule when a record is created, and every time it’s edited”
    7. Set the Rule Criteria to: NOT( ISBLANK ( Email ) )
    8. Add a New Field Update to populate the Hidden Email field
    9. Use this formula to set the new value: Email 
    10. Save and Activate the rule

    There you have it! No more duplicate emails within the Lead and Contact objects. 


  2. URL Hacking in Salesforce Custom Links

    This is one of the slickest and easiest tricks I learned years ago at Dreamforce. There are a number of ways you can hack URLs in Salesforce - I have implemented URL hacks for Custom Links and Custom Buttons. URL hacking (also known as the pv0 trick) allows you to populate report filter or object parameters. Adding a Custom Link to a home page layout or record detail page layout that links to a customized report can be a very simple way to impress your users! When I worked as a Marketing Analyst, I created a Custom Home Page Component to display a list of the Top Ten Reports for our Sales users. These were not simple links to the reports, but hacked URLs that would customize the report filters specifically for the user who clicked the link. Here’s how! This example shows how to create a Custom Link called My Unread Leads that is added to a Home Page Component:

    1. Create a Leads Report Type report
    2. Set the first filter to Lead Owner = Sales Rep Name Here
    3. Add a filter for Unread by Owner = TRUE to show only the Unread leads
    4. Add any additional filters specific to your org and customize the columns
    5. Save the report in a report folder where the users who you will expose the link to have read only access and copy the ID of the report (the 15 character code after your instance URL)
    6. Create a new Custom Link under Build > Customize > Home > Custom Links in the Setup
    7. Label it “My Unread Leads” and leave the default configurations as is
    8. In the Custom Link Editor, type forward slash and paste your report ID. Append the id with “?pv0={!User.Name}” and hit Save
    9. Create a new Custom Home Page Component under Build > Customize > Home > Home Page Components in the Setup
    10. Name your Component something meaningful, like “Sales Report Links” and select the Links type and hit Next
    11. Select your newly created Custom Link and move it to the “Custom Links to show” column and hit Save.
    12. If you are not already using a Custom Home Page Layout, you’ll need to create one in order to customize it under Build > Customize > Home > Home Page Layouts in the Setup
    13. When you get to the Edit Home Layout screen, make sure the checkbox for your Custom Home Page Component is checked and save the Home Page Layout
    14. Make sure the Custom Home Page Layout is assigned to the appropriate profiles
    15. Lastly, test it out by logging in as a Sales User and hitting the link on the home page!

    You can easily add a Custom Link to any Custom or Standard Object Page Layout as well. For Standards Objects, you will find it under the Object settings in “Buttons, Links and Actions”. For Custom Objects, it’s listed along with the rest of the Object metadata under the Search Layouts. I’ve created one on the Campaign object that links to a Campaigns with Leads report showing Campaign Leads Without Activities. I am passing the Campaign ID in the URL instead of the User Name, so the Custom Link customizes the report specific to the Campaign, not the running user.

    If you need to pass more than one parameter, you can do this by adding “&pv1={Merge.Field.Here}” and “&pv2={Merge.Field.Here}” and so on and so on until you are blue in the face! You cannot, however, pass parameters to filters within a cross-object filter.

    Hacking URLs is not officially supported by Salesforce, but the powers that be don’t seem to be restricting our ability to do this either. So for now, enjoy hacking those URLs! How have you hacked URLs in Salesforce?


  3. Fun with the PARENTGROUPVAL function!

    I’m not sure when exactly the PREVGROUPVAL and PARENTGROUPVAL functions originated in Salesforce… I do know that I built some extremely complicated workarounds to solve the same problem - namely, calculating the percentage of total value for a field in a group of records. This included using the Excel Connector to pull in values from numerous reports and one very giant master table where every cell was referencing another sheet or formula. Some people prefer to use Excel or some other BI tool to the built in Analytics package in Salesforce. However, I was pleased to discover these two functions existed within Salesforce and I want to share them with people who have never heard of them or don’t know how to use them!

    While working as a Marketing Analyst for a previous company, I was tasked with building a rollup report that showed the percent of pipeline dollars per campaign type against the total pipeline dollars for all campaign types for a specific period of time. If tasked with this now, I could use the PARENTGROUPVAL function in a Campaigns with Influenced Opportunities report type to solve for this.

    To see an example for your org (of course there are many ways to do this, but I’ll walk you through a simple example):

    Read More


  4. Interesting problems with DateTime calculations

    Recently, I had to solve some interesting problems using DateTime calculations in Salesforce. Our Technical Support group requested we come up with some functionality to assign Cases from the Queue to individual technical support reps only during business hours. Sounds simple enough, right? Wrong! Following are some lessons I learned and the solutions I implemented.

    This is a complex solution and I knew I had to at least answer these questions:

    1. Which day of the week was the case created?
    2. Was the case created after hours (for us, that means 5 PM PST until 12 AM PST)?
    3. Was the case created during a business holiday?

    Read More