Thursday, January 21, 2010

What Causes Invalid Apex Classes?

I’ve been training a new group of Salesforce.com Users on how to create change sets in a Sandbox, and deploy simple changes (in this case, Email Templates) to production. When we tried to deploy their change set, we encountered some problems caused by a different user group in the same org:

1.) Validation rules had been implemented by System Administrator users in the other group. The validation rules raised nearly a dozen DmlException errors, because they prevented existing Apex test methods to execute their insert / update operations.



2.) The deployment failed because the organization only had 72% test coverage. I hoped that much of this was caused by those same validation rules, but even after setting the offending validation rules to inactive, the org still had only 74% test coverage.

For this particular org, we have a very loose change management process. Business Owners, who deployed and implemented the instances with the help of a third party consultant, still have free reign in the instance. They don’t understand the impact their changes have on the Apex test methods or underlying applications.

I started reviewing the test classes associated with each DmlException error, and noticed a number of test classes had their “Is Valid” checkbox flag set to false.


I misinterpreted what the Apex Class list view was showing me: I saw the blank checkbox next to the word active and immediately thought “Why is this test class being evaluated, if it isn’t active.” I tweeted the question to the world, and my fellow Salesforce developers came to the rescue.

@dschach reminded me that Apex classes are always active:



So then I started poking around in the online help, I found the following notes about the “is Valid” designator:

"To aid backwards-compatibility, classes are stored with the specified version of the API that was used to compile them. Additionally, classes are stored with an isValid flag that is set to true as long as dependent metadata has not changed since the class was last compiled. If any changes are made to object names or fields that are used in the class, including superficial changes such as edits to an object or field description, or if changes are made to a class that calls this class, the isValid flag is set to false. When a trigger or Web service call invokes the class, the code is recompiled and the user is notified if there are any errors. If there are no errors, the isValid flag is reset to true."

I did a quick review of our Apex classes: 36 were set to Invalid. Ugh, that’s a lot of clean-up, and probably more than I can crank through in a single night.

@greenstork gave some helpful advice:



Alas, not so in our case – each of these 36 apex classes remained invalid, even after being viewed in production.

So what’s next?

1.) Short Term: I need to update the various test classes that flagged the DmlException errors, and modify them to support the recently added validation rules. Beyond that, I’ll need to look at other classes that are weak on test coverage, and move those to 100%. Then I can deploy my user's change sets.

2.) Long Term: The enterprise SFA application is much more complex than when the business owners first deployed and starting using it. Changes, like new validation rules or custom object / field edits can no longer be made in production. The business owners must adopt a more structured change management process, restricting their changes to Sandbox environments and allowing a QA/QC team to review the changes before deploying them to production. (Always a difficult political battle in any organization, but essential!)

3.) I need to update our Salesforce Audit report, with a periodic review of the “IsValid” field on Apex Classes. The purist in me says 36 invalid classes is too high; 0 is about right.

4.) I'm gonna need more coffee.

Thursday, January 14, 2010

Sending Scheduled Reports to Individual Users in a Restricted Report Folder

Scheduled Reports is a powerful feature of Salesforce.com.  It allows you to schedule a specific report to run – and have the results emailed in HTML format – to a specific user or group of users.  You can configure a report to run each morning at 7:00 AM, and have that report automatically emailed to all your direct reports.  Very handy!



One of my users with delegated “report admin” privileges uses this to great advantage, but ran into a problem:


“I have a Salesforce.com Report Folder which is restricted to a certain users: it is only visible to Manager and Director Roles. One of the managers has requested a copy of a specific report from this folder be emailed to him at the start of each business day. Scheduled Reports supports this functionality, but not if the report is in a restricted access folder. When you set the folder access so that only certain roles can access it, Salesforce.com does not allow you to select “Users” when setting up the “Send Email To” option. The Report Builder option only allows Public Groups, Roles, and Users. What should I do? I don’t want to create a “Public Group” with just one person in it, and I don’t want to make this entire folder public – help!”

Here’s the workaround I gave her:

1.) After hours, when no one is likely to be accessing the system, change the restricted access report folder to public.


2.) Use the “Schedule Future Runs” feature to schedule the report. Because the report folder is now “public”, you can select a filter option that allows you to send it to a specific user. Save the scheduled report settings.


3.) Go back to the Report Folder access settings, and change the access privs back to the original restricted access.




Viola - the scheduled report will still be sent to the users within the selected mail-to list, and your report folder is still private.

Thursday, January 7, 2010

If You Build It, They Will Come

We have thousands of sales reps. How can I motivate them to give up their “tried and tested” sales tools (notes jotted on paper, contacts stored in their heads, excel worksheets stored on their hard drives, etc.), and start storing their leads, contacts, accounts, opportunities, etc., in Salesforce?

Executive Adoption: The most essential aspect of any CRM implementation is executive-level sponsorship and adoption. Your C-level sponsor should have full access to Salesforce.com; as should their peers. If they don’t have it, get it for them. Your executive team will spend most of their time in the Dashboards, so spend a decent amount of time developing custom, C-level executive dashboards. Ask, “what would I want to see, if this were my company?” (because it is). Give your executive team Salesforce 101 training, covering the essentials of navigating within the tool, drilling into dashboard reports, and diving into the detail records below. Check in periodically (quarterly, bi-annually), and ask for feedback on what they would like to see added or removed from the Dashboard. Encourage them to monitor and engage your sales team on things they see happening through their Executive dashboard. When sales reps become aware that senior level management is in the tool, it will drive greater adoption and use.

What’s In It for Me? As a CRM Project Team, you need to make sure the system is LOADED with automation and other tools that directly benefit your sales team. If it’s simply another platform in which they insert data, it’s really not much improved over a basic spreadsheet. Instead, the tool must work for them. Consider AppExchange add-ons, like OneSource – which automatically populates contact data (titles, phone numbers, email addresses) and company data (company size, revenue, industry, etc.) when the Sale Rep enters some basic account information. Add personal dashboards that help the sales rep focus on their best prospects, key opportunities and sales pipeline. Design triggers that provide provide automated reminders for follow-up calls, etc. Integrate tools like DocuSign and DrawLoop, so that you can save your Sales Reps time with automated quote generation and electronic contract signatures. Integrate with back-end ERP systems, so that the Sales Reps can monitor post-sale activity. Use free tools like Ideas, Answers, Content, and Chatter to build a more collaborative work environment.

Make It Simple: Make your system simple for your sales teams to use. For your mobile warriors who live out of the cell phones, take advantage of Salesforce Mobile. Give them the ability to easily create or update leads, contacts, accounts, opportunity records from their handheld devices. Keep the input requirements minimal – don’t configure a dozen required fields on a new lead, when 2 or 3 will do.

Ride Alongs: Periodically ask if you can join members of your sales team as a “ride along”. Carefully watch and ask questions about their job, how they keep track of their day to day tasks, how they use Salesforce (or other tools). Always ask, “How can I make this system easier, so they have more time selling?”

Lead Assignment / Distribution: For inbound sales teams, adopt a system that distributes new leads based on each individual Sales Rep’s use of Salesforce. Example: Sally and Joe both have 10 leads currently assigned to them. Sally’s leads have a lot of recent activity (logged calls, email activity, trip reports / site visits), all logged within the system. In addition, she converted 3 leads to opportunities in the last 7 days. By comparison, none of Joe’s leads have been updated in the past 3 weeks, and he hasn’t converted any leads. Joe might have been contacting these customers, and making appropriate follow-up – he just hasn’t bothered to log it.
Don’t adopt a lead assignment method that evenly distributes leads to Joe and Sally. Reward the behavior you want your sales team to adopt by weighting your lead distribution system toward the CRM system users. Make sure it’s know to your Sales Reps how the lead distribution system works, and that it can be easily tracked on individual and team performance dashboards.

In addition to activity (recency metrics), consider a lead scoring system and how that might be used to influence lead distribution. In lead scoring, the “completeness” of a lead is used to calculate a value. For example, a lead that only has information in the customer name and phone # fields might have a score of “2”, while a lead that has information in the customer name, phone #, email, industry, company size, or other custom fields (budgeted amount, prospect urgency, etc.) might have a score of 7. The more fields they populate, the higher the lead score. A lead distribution system could use the cumulative score of recent closed/won or current funnel activity when determining how the lead should be routed.

Develop Dashboards for Sales Managers: Design your dashboards and reports in such a way that Sales Managers can see how well their team is performing against all the KPI they are measured on within the organization. Join their sales meetings, and listen to the topics they review – they design dashboards that show data along that same flow. Get the Sales Managers to drive their 1:1 and/or team meetings from these Dashboards. “Ok, team, let’s start with new leads this week. Joe, looks like you got a couple of leads listed as “hot”, but when I drive down into the detail record, I don’t see any recent call activity or notes to suggest why they are labeled that way – fill me in. <… listens …> That’s great. Let’s get that info updated into the lead please, before next week’s team meeting!”

If Sales Reps are keying their data into Salesforce, it’s important that Sales Managers use the tool for their status updates. The worse thing we can do as managers is to have our sales reps all this valuable information in the tool, but then when we call them into our meetings, ask them, “So, Sally … what did you do this week?” Sales managers need to be reviewing this information and be aware of what’s happening BEFORE they enter meetings with their team!

Tie Incentives / Compensation Plans to your CRM System: Your commission system must be based on information out of your CRM system. If the lead/opportunity is not in Salesforce, the Sales Rep doesn’t get commission. That’s a pretty simple, but it’s important to go beyond awarding sales just based on closed/won sales. Adopt incentive programs that enhance or accelerate commission based on the sale rep’s pipeline growth, timely lead nurturing / conversion, detailed account/contact/opportunity updates and activity / follow-up. Incent the behavior you want your Sales Team to adopt!

Remove their dependency on other systems (email clients, excel worksheets, etc.): Salesforce.com has a method for sending email from within the tool. Furthermore, when emails are sent through this method, the user can see if the recipient opened the email, how many times they opened the email, when they last opened the email, etc. Why would you ever send an email from Outlook? If the answer is, “that’s the system I’m familiar with”, then teach the new system! Show the benefit of being able to see when a customer reads an email, and act on that. Implement triggers that alert the Sales Rep, so they can do a follow-up call within the hour of the email being read. There are similar productivity tools for coordinating meetings, setting up reminder calls, automated email follow-ups, etc. Get the tool working for them, rather than make them work hard to get data into the tool.

CRM is a not a tool, it’s a strategy. Understand that you will be forever tweaking and optimizing your CRM system, so that it evolves as your business evolves. Make the process and the tool smarter, not harder.

And don’t hesitate to let me know if I can help!

Friday, January 1, 2010

How Do I Add My Own Custom Logo to the Salesforce.com Banner?

How do I customize the top banner, so that it displays my company's org, rather than the standard Salesforce.com logo?

The logo that displays in the top left corner is defined by the application that you are currently running. Salesforce apps are selected using the drop-down in the top-right corner. In the image below, I'm running the "Ideas" app, which uses the Salesforce.com Service Cloud logo.



TRIVIA: The default logo is updated several times a year, with each seasonal Salesforce.com upgrade. Salesforce.com usually comes up with two or three different logo ideas, and offers Customers a chance to vote for their favorite logos on the Idea Exchange. The logo that wins the most votes is used for the next release.


If you want your own custom logo, then you'll need to build your own "custom app". That's not nearly as difficult as it might sound. In Salesforce.com, an App is simply a group of Tabs. The "Sales Cloud" app includes tabs like Account, Contact, Lead, Opportunity, etc. You can create a custom app that uses these same Tabs, but features your company logo. Here's how:



1.) Using image editing software, modify your company logo so that it is less than 300 pixels wide and 55 pixels in height. The image must be a GIF or JPEG format, and less than 20 KB in size. Save this image to the Documents tab. Be sure to mark the image as an "Externally Available Image" when you upload it to the Documents library (see below):





2.) Create your custom app. Select "Setup -> Create -> Apps -> New".

Follow the App Wizard prompts to give the App a name, add your logo, and select the tabs that you want to be visible when users run this app.



That's all there is to it!





TIPS AND TRICKS:

Use a logo with a transparent background, unlike my sample above. If you use a logo with a colored background, you'll spend a lot of time tweaking the color scheme of your tabs so that they don't clash with the banner. The cyan background in my sample doesn't blend very well with the default green of the home tab logo ... blech!



During the photo editing stage, trim your logo so that it is exactly 300 x 55 pixels -- even if that means adding a filler space around the edges. If your logo doens't match these dimmensions exactly, Salesforce will resize the image to fit, but not always. You may find that your logo is distorted on some screen transitions, or that it displays outside the banner borders.



Each App that you build can have it's own logo. The number of Apps that you can make (and/or upload from the AppExchange) depends on what type of licenses you have:

Personal Editionn/a
Contact Manager1
Group Edition1
Professional Edition5
Enterprise Edition10
Unlimited EditionUnlimited
Developer Edition10

The custom app that you build (just so that you can display your own company logo) does count against the number of Apps you can download and run from the AppExchange -- so keep that in mind!



Pretty quick, pretty simple!