Heads Up: Custom Home Page Components Using iFrames may stop working in Summer 15

In preparation for my upcoming Visualforce course on Lynda, I discovered something that I think may have a big impact on some people out there that are using iFrames to embed a Visualforce page in the Sidebar. I have seen this technique used by several people over the years to display data in the sidebar and up until just recently the only way to accomplish this was to create a Home Page Component that referenced a Visualforce page using an iFrame. It was kind of a kludgy thing (sort of a hack really, so I am not surprised to see it go). I even wrote about this in a post back in November.

Well, with the Summer 14 release, there were big changes to how the HTML code is handled for these components. If you go to create a component now, you will not find a “Show HTML” checkbox that used to appear at the top right of the Rich text editor. The only exception to this will be if you created a component prior to Summer 14 that did contain Javascript or an iFrame. These components are still supported and will display the old editor (FOR THE TIME BEING!!!!).

BUT, the release notes clearly state the following:

In Summer ’15 we will start removing unsupported code from HTML Area home page components. As a result, components that contain JavaScript, CSS, iframes, or other unsupported markup might stop working properly. To use JavaScript or other advanced HTML elements in your home page component, we recommend that you use a Visualforce Area component instead.

This means that all those orgs that are using this technique may find their pages not working at all next year. You might want to check out SidebarSummarywhether your org has any Visualforce pages or even S-Controls that are still using iFrames, or JavaScript in the Home page component and make a plan to change them over to using the newly available Visualforce Area as the Component type. It really is cool and makes creating these type of components much easier. It is an improvement, but I wanted to make sure everyone was aware of it.

Speaking at Dreamforce 2014

I am very excited to announce that I will be presenting a session at the 2014 Dreamforce Developer Track entitled, “Career DreamforceStrategies for Developers Transitioning to Salesforce“. The main goal for this session is to offer practical ways that experienced developers that are just new to Salesforce can transition their skills to the platform.

I would love to hear from any of you that may be facing this unique challenge – either to share with me your experiences or to just tell me what you would like to learn. Please feel free to contact me through this blog with ANY feedback you may have. All feedback is welcome as I want this to be coming from multiple perspectives. Just go to the About Sara page and submit the contact form and I promise to get back to you quickly.

I really think this a chance to talk openly about something that is not often spoken of and I hope to answer the following questions:

How do you successfully capitalize on your existing development skills when moving to a new platform such as Salesforce?


What resources can you access to help you make the most of your transition?


Top 5 Tips for Improving Visualforce Pages

#1 – Reduce or eliminate view state   top5

View State is not your friend when it comes to page performance, so if you do not need it (as in your page does need to persist data between page requests), then do not use it at all. This is especially true for pages that will run on the Salesforce1 mobile platform!!!

How do you not use it all?

Do not include the <apex:form> tag unless you absolutely have to. This tag should only be used when you are accepting input from the user, so if you are only displaying data to the user, you should not have a form tag.

Like this Post? Then you will really like the “Improving Visualforce Performance” course that I designed for lynda.com. It was based on this post specifically and goes into great detail about each one of the tips in this post. Check it out!

And, even if you are accepting input, it is likely that not all the data on your page needs to be submitted through a POST request. For example, you could have a page that lists some account data, but only allows the user to change one particular field. In cases such as these, you could use the Transient keyword in the Controller class to make all the data fields (and especially collections) that are not being changed read-only. This means they will not be stored in the view state and your page will load faster.

You should also consider using JavaScript Remoting to avoid View State state by invoking the Apex Controller or Extension from JavaScript instead. This puts more load on the front-end and typically results in more code, but for certain pages that demand fast performance (especially those on the Salesforce1 mobile platform), this may be a necessary tradeoff to consider. But, if you do decide to go this route, make sure you use very efficient JavaScript code, so you do not violate Tip #5.

#2 – Evaluate SOQL for Efficiency

There are several ways you can write better SOQL code. For starters, ALWAYS make sure you place SOQL queries outside of loops. This should be done no matter what. It will not only make your page perform better, but will help avoid limit errors and should be standard practice. This also applies to DML.

Beyond that essential tip, you should also consider:

  • Only return fields that you are using on the page
  • Use WHERE clauses as much as possible to restrict the number of records returned
  • Use indexed fields in your WHERE clause as it will make the query optimizer work better. Default indexed fields are Id, Name, Owner, LastModifiedDate, and any foreign key or ExternalID fields.
  • Use the LIMIT keyword when possible
  • Use aggregation functions such as COUNT()
  • Use the WITH SHARING keyword in your controllers since the sharing architecture is used by the Query Optimizer and you will only retrieve the records that the users has access to
  • Additional suggestions (per reader JSON Hammerle) are to:
    • Use native (more selective indices) when possible
    • Hash your composite key (if you have one) into the native name field and use this hash in your WHERE clause This is comparable to a skinny table but you don’t have to work with support – and it can be delivered in a managed package.
    • Order your WHERE clause from most selective to least

#3 – Reduce use of Action tags

This kind of goes with tip #1, but since it is so important, I wanted to make it a separate point. Action tags such as <apex:ActionPoller> and <apex:ActionFunction> seem great on the surface since they are VERY easy to use, but they are memory hogs, so limit your use of them and consider alternatives.

Rather than using the ActionPoller tag, you should consider using the Streaming API. It means more code for you, but it results in no view state (remember tip #1). If you do not like the Streaming API, then consider using traditional polling using a Meta tag with a refresh and a window.location.reload.

Rather than using the ActionFunction, ActionSupport, ActionRegion tags, use Visualforce Remoting which uses no view state. Like I said earlier, it results in more code and complexity for you, but for certain pages this may be necessary. Again though, make sure you incorporate efficient JavaScript. Do NOT just copy and paste the first JavaScript snippet you find by doing a Google search.

#4 – Take Advantage of StandardSetControllers when dealing with lists of data

StandardSetControllers, which are used to create list controllers are your friends and you should use them whenever possible. The StandardSetControllers are optimized to work with large data sets of up to 10,000 records and include pagination features (which you should be using) automatically. There is no need for you to do this yourself.

When you do use them, instantiate them using a list of sObjects instead of from a query locator, as this is a more efficient way.

#5 – Incorporate Best Practices with all JavaScript, CSS and Images

No Visualforce page will perform well if it includes poorly used or inefficient HTML technologies. Make sure you incorporate best practices when including things such as Javascript, CSS and images. Things such as this:

  • Remember less is more and smaller is better.
  • Files should be minified and use Static Resources
  • Avoid using global variables
  • Place Javascript at the bottom of the page when possible and use the <script> tag and not <apex:includeScript>
  • Use browser caching when you can
  • Avoid use of iframes

There are tons of documents out there about best practices. Two of my favorites are:






Considerations when using Javascript in Visualforce

As part of my research for the new Lynda.com course I am doing on Visualforce, I have been going through posts on the Salesforce forums. I ran across this one in which the poster was asking what was the best way to select multiple checkboxes on a Visualforce page when a “Check All” checkbox was selected.

The best answer that was chosen was a recommendation by someone to use the ActionSupport component. The accepted responder even provided sample code. While the response was technically correct, I did not think it was the best solution. The reason I say this is because if you execute the sample code provided, you will note that there is a significant delay between the time you select the “Check All” checkbox and the time the other checkboxes are selected.

What causes the delay?

The ActionSupport component, which adds AJAX support to another component, allows that component to be refreshed asynchronously. While you might first think, “Asynchronous, that executes on the client and that is good and fast, right?”, that is not really the case. You see, when you use ActionSupport, or ActionFunction, or any of the action tags, you are essentially invoking server-side logic that is contained in your controller. This means that the AJAX request includes the pages view state and this can affect performance, as it did in the very simple example from this post.

So why use these controls?

Well, they are much easier to use than some of the other alternatives (which you can read more about here) and typically result in less code. But, if you are a good software developer, then you should not just blindly accept the path of least resistance. The other alternatives (namely Visualforce Remoting) will certainly perform better, but then they do require more code to be written. There is always a trade off, you see.

So, what is the best solution for this problem?

Well, I know you are going to be annoyed when I say this, but the answer is, “it depends”.

You could say the best alternative is one that was suggested by another responder on this post. That responders suggestion to use client-side JSJavascript (such as is provided in this post) was not accepted as the solution, but if you execute the code provided it does execute extremely fast. The difference in performance between the two suggestions is day and night (IMHO). But, this requires you to write and maintain the extra Javascript code.

If you are just sold on the whole, “it is better to use the built-in Action components provided by Visualforce because they simplify the code”, then you might want to consider adding an ActionStatus component right below the ActionSupport component. This is used to provide a message to the user telling them when the process starts and ends. That would prevent the user from just sitting there dumfounded for 1 – 3 seconds while the code was executing.

You might also want to consider using some of the other Javascript alternatives suggested in this excellent Developer Relations post on Using Javascript with Force.com.

You see, it really all depends on what you are trying to accomplish and what skills you already have. If you are blessed to have the time to consider other options, then I suggest you do so. There are often many ways to accomplish the same thing and rarely is one way always the best way.


HUGE Backlog for Registration of the Advanced Developer Programming Assignment

AdvancedDevCertBad news for anyone pursuing the Advanced Developer Certification. There is such a huge backlog, that I was just informed that I will not be able to register for the June, 2014 programming assignment as I had been expecting. Because of the backlog, I will now not be able to register until September, 2014. That sucks and I wanted to share this with you all.

According to Salesforce the following schedule now applies:

  • Candidates who completed the multiple-choice exam prior to December 1, 2013 and have not yet attempted the programming assignment and essay exam will be invited to participate in June, 2014.
  •  Candidates who completed the multiple-choice exam prior to April 1, 2014 and have not yet attempted the programming assignment and essay exam will be invited to participate in September, 2014.
  • Candidates who completed the multiple-choice exam after April 1, 2014 and have not yet attempted the programming assignment and essay exam will be invited to participate in December, 2014.
  • Candidates who have previously attempted the programming assignment will be invited to register for the programming assignment and essay exam in December, 2014, or in earlier windows as capacity is available.

For anyone stressing out about getting through with their multiple choice exam, you might want to factor this news into your preparation.

Sorry to be the bearer of such bad news, but I guess this just goes to prove how valuable this certification is – Salesforce is overwhelmed by the number of people attempting it. Capacity is limited to only 200 people per round.

Career and Survival Strategies for Software Developers

QuestionsI just watched a Pluralsight course that I think EVERY software developer should watch. It is for developers brand new to the field, those that have been developing for only a few years, and those that have been developing for many years.

The course is general and non-technical, but is highly informative, extremely insightful, and remarkably hilarious.

The course is titled, “Career and Survival Strategies for Software Developers” by Dan Appleman. Dan talks honestly about the things that are important to every developer, but that are oddly hardly ever mentioned. Things like:

“How do I keep up with the latest technologies and not become obsolete?”

“How do I deal with all the professional politics that go along with being a developer?”

“How do I make the kind of money I need or want?”

So please take the time to watch this course and let me know what you think…

Back up your Phone Right NOW!!!!

Last Friday evening, I stopped at a local convenience store for just a few seconds. PhoneBackupTwenty minutes later, I reached towards my phone cradle to make a call and realized my phone was gone.

Stolen, you ask? It certainly appeared that way.

I acted quickly. I returned home and immediately called my carrier to report the phone as stolen. They issued a block that would prevent anyone from using the phone on another network.

The next day I called the carrier back to see what I could do to get a new phone. I was lost after all and was already feeling highly anxious. I am sure you would feel that way too.

The nice woman on the phone told me she could send another phone and then asked if I had a backup. I sheepishly replied, “No”. The shame is that I am a developer by profession. Of anyone out there, I should know better. Heck, I even spent two years working for a company whose main selling point was providing companies quality backups.

Yet here I was…up the proverbial creek – without a paddle, or a backup. Nope my last backup was done 6 months prior. 6 months! Outrageous!!!!

Now, fortunately this story does have a happy ending. 3  hours after I hung up the phone with my carrier, I returned to my car to clean it. Guess what? My phone was there. It had accidentally fallen out of the cradle and fell under the seat. It was there all the time. Never stolen. I was a VERY lucky girl.

I consider it all to be an omen and a reason for me to share this warning with others. Do not find yourself in the same unfortunate position. As technology professionals, we really should know better and we really should ensure that we do regular backups of our machines AND devices. Especially our devices. These days they tend to hold more valuable information than our computers.

So please, take the time to make that backup right now.

And also, don’t leave your phones in your car, even for a second.

Take Care,


Comparing the Force.com SOAP API to the New Salesforce Toolkit for .NET

Last week I sat in on a webinar titled, “Build Customer Centric Applications Using the Salesforce Toolkit for .NET“, presented Tools_ce2c5aby Wade Wegner and Richard Seroter. As a .NET developer, I was excited to see a new way of connecting Salesforce via .NET. But, I was REALLY excited when I heard that the new toolkit was open-source and provided native libraries that utilized the async and await model in .NET.

I instantly knew that this new method would provide a lightning fast, near real-time alternative for connecting to Salesforce. And, after a little effort putting together a benchmark application, I was able to prove it.

At first, I tried to create a web application using Visual Studio 2010 that would test both the Force.com SOAP API and the new Salesforce Toolkit for .NET. Unfortunately, since the new Salesforce toolkit depends on the Task object and the async and await keywords (which came about with .NET Framework 4.5), using Visual Studio 2010 was not an option.

So, I moved the code to a Visual Studio 2012 web application and added the new Salesforce Toolkit via NuGet Packet Manager (NOTE: that you will need to have NuGet client version 2.8.1 or above, so you may have to take an extra step of upgrading that as I did).

The test application was simple. For both tests, a connection to Salesforce was established and a new case was created. A StopWatch timer was used to measure the run time to the millisecond. The Results?

Well, you should not be surprised to learn that the async-based task using the new toolkit was so fast, it did not even register a single millisecond. That’s right, the time returned was 0.0.

Creating the case via the Force.com SOAP API took an average of 2.32 seconds. Now, you might think 2.32 seconds ain’t bad. But, that time will always vary and could be much longer depending on the process to perform, amount of data and connection speed. There is just no WAY a synchronous method will ever be able to compete with an asynchronous process in terms of processing speed. PERIOD!!!

Now, that also does not mean that the new toolkit does not have it’s issues to consider. Asynchronous processing by itself brings about all sorts of other considerations (such as more complexity), and the following lists some things to consider if you choose to move forward with using the new Salesforce Toolkit for .NET in your org:

  1. You will have to create a connected app in your Salesforce org and then reference the consumer secret and key it provides inside of your code. See this post by Richard Seroter for more on that.
  2. If you use the new toolkit with an ASP.NET page, you will need to do a few extra things, like add an Async=”true” attribute to your page tag and register the async task. Go here to find more information about how to use asynchronous methods in ASP.NET 4.5.
  3. You will have to create a class that defines the Salesforce object you are accessing. This is the most annoying part for me and something I would like to see addressed. With the Force.com SOAP API, you can reference these definitions through the Web Reference you create. You do not have to create them specifically. This means that the Salesforce Toolkit is loosely tied to your org and therefore does not respect any required fields when it comes to object creation. I actually experimented with using the Case reference from the SOAP API in my asynchronous call using the new toolkit, and got back an error when I tried to add a case with no ClosedDateSpecified. This error was not thrown back when I used my own custom class to define the minimal fields for a Case object.

As far as the code is concerned, the following is the code used to perform the test using the new Salesforce Toolkit for .NET:

public class Case
        public string Id { get; set; }
        public string Subject { get; set; }
        public string Description { get; set; }
        public string AccountId { get; set; }
        public string Priority { get; set; }
        public string Status { get; set; }

public partial class Test : System.Web.UI.Page
        public const String subject = "Test Case";
        public const String description = "testing";
        public const String accountId = "001d000001UsLAX";
        public const String priority = "Medium";
        public const String status = "New";
        public const String username = "your user name here";
        public const String password = "your password and security code here";
        public const String consumerKey = "your connected apps consumer key here";
        public const String consumerSecret = "your connected apps consumer secret here";

        protected void Page_Load(object sender, EventArgs e)
        protected void NewToolkit_Click(object sender, EventArgs e)
            //Time how long it takes 
            Stopwatch sp = new Stopwatch();
            RegisterAsyncTask(new PageAsyncTask(TestToolkit));
            TimeSpan ts = sp.Elapsed;
            //Display the Results of timer
            lblResults.Text = "Runtime: "
                + String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                    ts.Hours, ts.Minutes,
                    ts.Seconds, ts.Milliseconds / 10);
        async Task TestToolkit()
            //create a connection and get a token to create a new client
            var auth = new AuthenticationClient();
            await auth.UsernamePasswordAsync(consumerKey, consumerSecret, username, password);
            var instanceUrl = auth.InstanceUrl;
            var accessToken = auth.AccessToken;
            var apiVersion = auth.ApiVersion;
            var client = new ForceClient(instanceUrl, accessToken, apiVersion);

            Case sfCase = new Case()
                Subject = subject,
                Description = description,
                AccountId = accountId,
                Priority = priority,
                Status = status

            string Id = await client.CreateAsync("Case", sfCase);
            lblMessage.Text = "The following case was saved sucessfully: " + Id;


Approved as a new Lynda.com Author

lynda_logo1k-d_72x72I just got word that I have been approved to be a new Lynda.com author! They want me to design a series of courses on Salesforce development. They currently have none, so this is very exciting. One of the things I really like about Lynda.com is their commitment to high-quality productions. They are leaders in the area of online video training.

The first course will likely be very introductory (such as “Up and Running with Visualforce Development”).  If you have suggestions for areas you think I should cover, I would love to hear from you. Feel free to comment to this post or to send me a message directly though my contact form.

I will be sure and announce when the course is approved and of course, when it is released. Until then, please send me your thoughts.

Finally Passed the Advanced Developer Multiple Choice Exam!!!

This is no April’s Fool joke. Yesterday, I finally passed the Salesforce Advanced Developer Multiple choice exam!!! It was my second attempt. The first attempt was 6 months ago, but I now know that I was not ready then, so it was a good thing that I did not pass.

Back then, I barely knew the material. I thought I knew it because I had memorized it, but that did not mean that I “understood it”. I am now happy to say that I “know” this stuff. I know it like I know the back of my hand. And, that is a VERY good thing, because I now wait to complete the next stage of the process…the dreaded programming assignment.

Unfortunately, I have to wait until the next limited registration period (which is not until June 2). But, I am confident that the skills I have acquired so far will not atrophy before then. If anything, they will just continue to improve.

So, how did I learn this stuff like the back of my hand? I did it by following EVERY suggestion on Forceprepare. I basically did all of the following:

  • Obviously, I memorized all the notes I have posted on this site (but that was just the beginning and was not enough by itself to pass)
  • I watched the entire re-broadcast of the 501 Dev Class (which I posted about here). I took additional notes from that and posted them to this site (still not enough to pass). UPDATE, sorry to say but Salesforce has since removed the re-broadcast links from the 501 class.
  • I watched all of the 8 training videos on Pluralsight (which I posted about here)
  • I watched at least a dozen or more videos from Dreamforce.
  • I read countless blog articles from experts like Jeff Douglas, Matt Lacey, Bob Buzzard, etc
  • I worked through all the code in Bob Buzzards latest book, The Visualforce Development Cookbook (which I reviewed here).
  • I worked through ALL the Workbooks on DeveloperForce (they have been updated recently and they are REALLY GOOD).
  • I read through the entire Developers Guide (and YES, I know it is LONG).
  • The MOST important thing: I played with all the code on my Developer org (which is now packed with best practice code examples).

When I took the test yesterday, it was so easy to me. I could see through all the tricks they had put in. It seemed really obvious to me (which I think will make the programming assignment phase a breeze). Bring it on, I say. I just wish I could do it sooner.