Trailhead: Event Log Monitoring

 

trailhead_module_shield_event_monitoringSay what?  Event Monitoring?  What’s that?

Winter ’15 delivered a little hidden gem – Event Log Monitoring (ELF).  ELF enables the ability to see a lot of the things that are happening in your org behind the scenes that you just could not answer before – such as:

“Did [x] download my customer list before quitting?”

“How fast is my Visualforce Page loading?”

“Who clicked on a record?”

“Holy moly!”

That’s honestly the only phrase that comes to mind when I’m staring at the new ELF files that I can access.  I can’t tell you how many times I’ve been asked just that first question above by my customers…and up until now all I’ve been able to do is offer future-looking convoluted technical solutions to prevent it from happening in the future.

Ok Andy – I’m not a developer and what I’ve read so far is full of something called “Workbench” and “JSON”.

That’s the best part!  Even though this is really an API-only feature, Salesforce and the community at large have created some great tools (even free in some cases) to help anyone take advantage of this critically important new feature.  *cough* Trailhead *cough*

Ok Andy – enough beaming, let’s get down to brass tacks.  How do I use this?

trailhead-emblemOk.  First things first – let’s start with the new Trailhead module on ELF!  Click here to get started.  “Why would I do Trailhead before just jumping in?” do you ask?  In my opinion, Trailhead is becoming the de facto “first stop” for Salesforce training.  The biggest benefits that Trailhead gives you with ELF are:

  1. Well written content
  2. Real-world examples
  3. In-depth yet contextually appropriate knowledge bullets
  4. “One step further” with great tools and visualizations for ELF

Let’s face it – ELF is not declarative-friendly; this is an API-only feature.  There is no standard UI interface for ELF, you download this data as an array of data and then have to make it useful through a number of visualization tools.  Trailhead takes this situation head-on and gives you INCREDIBLE tools such as Salesforce-ELF to easily retrieve the data you want without needing to write scripts and decipher REST in Workbench, and then visualization tools such (free) Cloudlock Event Monitoring Viewer to actually get you answers to burning questions.

Honesty time:  I read about ELF in the Release Notes, but I saw raw JSON responses and immediately shelved this as “wow, that’ll take some time to visualize…I’ll do that ‘later’.” When Trailhead released their module on ELF – I learned more in 45 minutes than I ever would have by following the release documentation and stumbling around on my own.

So, what are you waiting for?  Head over to the ELF module on Trailhead and start now!

How are you using ELF?  Sound off in the comments below or hit me on Twitter – @andyboettcher!

Productizing your salesforce.com Deployment – Part 1

production-planning-and-scheduling-70

What the heck is “Productization”?  Is that even a word?  Not according to Merriam-Webster, but it’s a word that you will want to introduce to your vocabulary!

We all absolutely love implementing Salesforce – the thrill of setting up a new org (aahh that new org smell!), getting business requirements, and building out exactly what the business needs.  Who doesn’t love doing this part – I know I sure do!

So what happens after “launch”?  Many companies continue at the same velocity as they had during the build phase – which may keep noisy users at bay, but how often do we think about those non-noisy users?  How often do we think about “implementation fatigue”?  What about other areas of the business that want to onboard?

Often, we end up thinking of such things months or years down the road when data starts becoming shoddy, management stops managing from the tool, or you find the users have created a thousand Excel sheets with PivotTables to actually output useful reports because their data source keeps changing.

Enter….Productization.

So what is “Productization”?  Productization is the process of taking your platform and taking it from the adhoc building phase to a more of a traditional enterprise platform “tool” that is predictable, stable, and trusted.  Picking the phrase apart – you are essentially making a “closed” product that your users just pick up and use, similar to how they would use Excel, Word, etc.

One thing that many people confuse with a “Productized” solution is one that is static, closed, or non-responsive to changing business needs – absolutely not the case!  This is where you start really exploring and implementing those fancy themes that consultants throw around such as governance/change management, formalized ideation, or formal on-boarding processes.  You want to create a PRODUCT.

This blog post is the first in a series that will discuss the overall themes and approaches of a “Productization” roadmap.  Today we’ll be talking about user expectations/management, speed/velocity of change, and involving your users in the ideation process.

calm1Let your users breathe!

The double-edged sword that is salesforce.com is that it’s incredibly configurable…by anyone in the organization.  This ability is second-to-none when we’re building and honing in the platform, but all of that effort is leading you to your “release version [x]”.

One of the greatest hurdles to any salesforce.com implementation is adoption; many adoption approaches can be utilized such as “creating [x] records per week”, “managing from the tool”, or “compensation driven from the tool”, but for those doing day-to-day work in the system stability can mean just as much or more than anything else.

Think about it – would you look forward to using a tool at work that you never trust is going to be the same tomorrow?  How much effort would you put in to learning how things work or much less how to make them more efficient if tomorrow everything could change?  Having a tool that is predictable fosters an environment where users trust the system and invest more time/energy to using it.

Slow your roll….

This also introduces an almost backward concept – slowing down the speed at which your business customizes salesforce.com.  Out of the gate, you are making objects, fields, rules, and writing code to beat the band.  Once you get to “release version 1”, you need to switch your thinking away from “YES!  THERE!  HOW’S THAT??!” to “Yes, let me understand exactly what you’re trying to do, and how it can benefit or detriment the entire organization”.  (ok, that’s a pretty major generalization, but roll with me here…)

To associate a silly visual – “the cockroaches scatter when you turn on the lights”.  The same visual can be applied to users and change – if you change your system haphazardly, your users will scatter!

No, I did not just compare users with cockroaches.  🙂

Ideation Collection and Execution

Very few things have the impact on the overall success of your solution more than a fully engaged user base.  Providing your user base with a forum where they can bring new ideas to light, have prioritization input on the implementation of said ideas (with the assistance of a steering committee), and can bring fixes/improvements back to their peers is both empowering and invaluable.

Next up…

Once you throttle back the engines and make the current users and management stable and happy – then let’s start talking onboarding units and users, but next time!

“Salesforce is Slow” – what can you do?

20080730_server-crashYou cringe when you hear it – “Salesforce is slow!” or “Salesforce is broken!”.  Those two phrases increase stress levels and can quickly catch fire in your organization and negatively impact user adoption and confidence.

In the YEARS I have been working with Salesforce, I can count on two hands the total number of times that the service has been actually “DOWN”.  Most of the time, it’s internet routing issues, DNS, and a whole slew of other factors, some of which you can help mitigate if you take a look at the connection between the end user’s workstation and the Salesforce server pods.

The areas YOU can have an effect on are split in to three areas, starting with the client workstation and moving out to the cloud:

Workstations (and mobile devices!)

Workstations are the “front lines” of your organization – computers, tablets, phones, etc.  This is where the majority of your problems are reported and where you can spend a lot of time supporting ghost issues.

Standardize your company on a single (and current!) web browser

Chrome, Internet Explorer, Firefox, Opera – whatever your organization’s preference is – make a decision and stick with it.  You can read the official “Supported Browsers” article by Salesforce to get additional information, but there are so many issues that exist because people are using outdated browsers!

https://help.salesforce.com/HTViewHelpDoc?id=getstart_browser_overview.htm&language=en_US

Ensure that your workstations and devices have the latest and greatest security patches

Salesforce.com has a very low risk of malicious code or other in-sundry hacking things being done, but patches cover more than just security issues.  Network resolution, memory usage, all kinds of other things are regularly addressed through service packs and periodic updates.

Don’t cheap out on memory!

Memory is relatively cheap now – when purchasing a new workstation, 4gb or 8gb is now the MINIMUM you really need in a workstation, no longer is it only reserved for developers or engineers!  Low memory can manifest itself in a general computer or device slowdown and even to slowed rendering of web pages.

Servers

DNS

The one major thing that your server infrastructure (or if you’re a small biz or home worker, your router itself) provides for you is DNS resolution.  DNS stands for “Domain Name Resolution” and is the sole player that sends your request for “login.salesforce.com” to an actual server on the Internet.  Without DNS, you cannot reference ANYTHING on the internet by name.

Part of a solid “consumption” DNS strategy is to be able to reference multiple providers across multiple carriers.  Most of the time, IT departments have either just one or a few DNS servers defined that reference your ISP’s servers only.  If your ISP has issues – the broader Internet isn’t down, but you are!

There are a number of public DNS servers – most notably Google Public DNS – that you can reference along with your ISP’s DNS servers to help in the event something somewhere goes awry.

Network

Quality of Service / Traffic Prioritization

How your browser request makes it through the “series of tubes” to the Salesforce servers and back (it’s a round trip!) can be affected by a large number of factors.

In most business environments, there is an appliance that controls all traffic in or out of your network – typically called a “router” or “firewall”.  These appliances often have a feature called “Quality of Service” or “Traffic Prioritization/Shaping” that can help prioritize the transmission of packets meant for Salesforce.com over those that belong to someone’s music streaming or Youtube video.  Most of the time, you can prioritize based on destination and source IP address – which you can set to be the Salesforce pod addresses.

NOTE!  You can use QoS to control packet transmission on YOUR NETWORK ONLY.  QoS has no lasting effect as it transmits across the Internet.  Often times though, proper prioritization within your network is enough to know if it’s either how you are using your bandwidth, or if you have to upgrade your…..

Internet Speed

This is a common issue that I see when I hear that dreaded “Salesforce is slow!” comment come across.  There are two sides to your internet connection:  upstream and downstream.  When you hear an ad for Comcast / Cox / <name here> advertising “the fastest speeds around”, they are only talking about downstream – or how much bandwidth you have downloading content.  Rarely do they ever mention how fast you can UPLOAD things.  I know that sounds weird, but even while browsing, at minimum you have to use the upstream side of your connection to acknowledge the receipt of what the web server is sending you.

If someone else on your network is uploading a huge file to a vendor via FTP and taking up all of the bandwidth, you will see a MARKED slowdown in your regular browsing speed.  (you can help this – see the QoS topic above)

Failover / Multiple Internet Connections

If you have a larger organization or one that very data-intensive, you could also benefit from having multiple internet connections.  Most enterprise-grade (and even some small business grade ones!) have connection load balancing or failover built-in or available as an upgrade for a small fee.  Apart from the obvious benefit of if one connection fails completely that you can seamlessly roll over to another one, you can setup rules to ensure that certain traffic goes out over one connection and other traffic (like Salesforce!) goes out another.

You can also read this article from Salesforce that talks about some of these items and a few more:  https://developer.salesforce.com/page/Network_Best_Practices_for_Salesforce_Architects

Happy networking and questions down below!

Flow and FinishLocation

pulling-hair-out-321x300Have you tried using Flows with Visualforce pages and tried to set the finishLocation to a dynamic value?  Odds are yes, and odds are even better that you had (or are having) no end of frustrations trying to get it to fire right.

The key to get your dynamic finishLocation to fire right is to factor your PageReference in such a way where as you are progressing through the flow and while the wrapper Visualforce page is rerendering, you can effectively capture and utilize Flow output variables.

To start, let’s embed a flow in a Visualforce page:

<apex:page controller="flowController">
<flow:interview name="DemoFlow" interview="{!flDemo}" finishLocation="{!prFinishLocation}" />
</apex:page>

You’ll note that the “interview” attribute is in use.  That is one of the necessary steps to make this work – you need to link your Flow to the controller.

public class flowController{
// Instanciate the Flow for use by the Controller - linked by VF "interview" attribute
 public Flow.Interview.DemoFlow flDemo {get;set;}

 // Factor your PageReference as a full GET/SET
 public PageReference prFinishLocation {
 get {
 PageReference prRef = new PageReference('/your/page/location?var1= + strOutputVariable);
 prRef.setRedirect(true);
 return prRef;
 }
 set { prFinishLocation = value; }
 }

 // Factor your Flow output variable pull as a full GET / SET
 public String strOutputVariable {
 get {
 String strTemp = '';

 if(flDemo != null) {
 strTemp = string.valueOf(flDemo.getVariableValue('your flow output variable name');
 }

 return strTemp;
 }

 set { strOutputVariable = value; }
 } 

}

You’ll see that both the finishLocation’s PageReference as well as the variable that captures the Flow’s output variable are all in fully broken out GET/SET logic.  Factoring your code in this manner is the trick; as you move through the flow, the Visualforce page re-renders each time the user progresses through a Flow Screen.

**NOTE!  There is also a trick to how your actual Flow is set up.  For instance – if your Flow is creating a Contact and you want to direct the user to that Contact’s standard detail record upon completion of the Flow, you will need to have one last screen at the end to force the Visualforce page re-render so your controller can grab that Contact’s Id.

**ANOTHER NOTE!  You will NOT be able to get 100% test coverage when you link Flow to a controller like this.  Because Flow requires user-interaction, if you try and reference the “flDemo” variable from the example above without first checking to see if it’s null (which it will be in the Unit Test), your test will fail.  There is NO way right now (confirmed by Salesforce) to full test a Flow using this method…don’t pull your hair out trying.

Good luck!  Hit me up in the comments if you have other great Flow hacks or if you have issues getting this method to work.

Thanks for reading!

Salesforce Integration Best Practices

DCSLogo_Maroon-Horizontal-GradientIntegration / interoperability is no longer an “if”, it’s a “when”.  Make sure you approach your project correctly and set you and your company up for success.  Check out a great “Best Practices” blog post I contributed to at Demand Chain Systems!

http://bit.ly/19fUIqu

Visualforce Page Printable View

f02a62983ebcHow many times have you been asked to “can you make that a printable view, ya know, without the top and sidebar?” when you create a Visualforce Page?

If you have, you know the deal.  If not, oh don’t worry, you will before too much longer.

There is a quick and easy way to use the same VF page and APEX Controller that you already have built, using some Page variables, OutputPanels, some minor Javascript, and your “action” page attribute.

Step 1:  Create a Boolean variable and an “init” void method in your Controller

Something to the tune of:

public Boolean bolPrintableView {get;set;}

– and –

public void init() {
 String strPrintableView = ApexPages.currentPage().getParameters().get('print');
 bolPrintableView = (strPrintableView == '1');
}

Step 2:  Modify your VF Page attributes

<apex:page controller="YourPageController" showHeader="{!bolPrintableView}" sidebar="{!bolPrintableView}" action="{!init}">

Step 3:  Add a “Printable View” link to your VF Page

I will usually do this with an OutputPanel with the “rendered” attribute being set to the opposite of my controller’s printable view flag.  Doing this gets rid of the silly link for “Printable View” on your printed page along with any silly users clicking on the button again.

<apex:outputPanel rendered="{!NOT(bolPrintableView)}">
    <a href="/apex/YourVFPage?print=1" target="_blank">Printable View</a>
</apex:outputPanel>

Step 4:  Use a quick Javascript function to immediately call the print dialog on load

Again I’ll usually wrap this in another OutputPanel with the “rendered” attribute being set to what the printable view flag is – we don’t want this firing on the normal view of the page!

<apex:outputPanel rendered="{!bolPrintableView}">
 <script>
  window.print()
 </script>
</apex:outputPanel>

Optional Step 5:  Some pages just look better in Landscape mode – let’s use some CSS so it pops up like that by default.

<style type="text/css" media="print">
 @page { size: landscape; }
</style>

That’s it!  Works like a charm.  Questions?  Hit me below in the comments!

Public Anonymous Web Service on Salesforce Platform – No Login!

39645249So I was approached recently with the need to expose data to a vendor.  “Sure!” I thought…”What’s your endpoint, WSDL, and the format you want your data sent in?” was my initial response.

“No, we need to pull from you.” threw me for a loop – Salesforce ABSOLUTELY allows you to expose web services, but you need to establish a session first.  For an established vendor with 1,000’s of other clients they poll data from, there is no way in heck that they would change their process to add a log in component.

Hmmmph.  Well, let’s figure this out.  Salesforce is awesome, and there is always a way to do this.

Step 1:  Create your APEX Web Service

global class Generic_Whatever_Service {
webService static String yourWebService() {
String strReturnValue = 'Put whatever normal logic in here you would do';
return strReturnValue;
}
}

Step 2:  Create or Navigate to a Salesforce Sites instance

You’ll need to go in to the “Public Access Settings” button and configure the Guest Profile to be able to access your APEX class and any other objects that it may hit.

Step 3:  Download your WSDL and modify your endpoint

You’ll note that the endpoint in the WSDL is set to be https://yourinstance.salesforce.com/services/soap/class/name_of_your_class.  If you try to access this as it’s provided, you’ll be prompted for a sessionId, hence a login.

If you change your endpoint to be http://<your Sites URL>/<your Sites name if applicable>/services/soap/class/<name of your class> you’ll find that you now have a fully anonymous web service!

WAIT!  Don’t forget about security!

Honestly, there is no reason that you need to have a fully anonymously-accessible web service hosted by Salesforce.  The platform does a lot, but it’s just not geared for that IMHO.  (You should have an environment built for this if you are hosting data like that)

What I’ve done with the services I publish like this is to lock down access to it via the Guest Profile’s “IP Login Ranges”, found through the “Public Access Settings” button in Sites.  While this method doesn’t completely shut down access, people outside of your specified ranges will get an “INSUFFICIENT_ACCESS” error when trying to access your web service.

Questions?  Ask below.  =)