Tuesday, May 14, 2013

Salesforce Summer 13 - things I've noticed

Automated Apex Test Execution

The code at http://developer.force.com/cookbook/recipe/automated-unit-test-execution now produces different results.

In my case, the number of results has nearly tripled. Interestingly, the number of failed tests increased. This code shouldn't have excluded any failed tests, so it seems to me that there is a bug fix in Summer 13 for the ApexTestResult object. This means the outputs of this code prior to Summer 13 probably aren't trustworthy.

Developer Console - now slower than ever

I have to work with older versions of IE a lot (don't get me started). Prior to Summer 13, Developer Console was pretty slow but usable. Now I get a lot of hanging and the slow script dialog.

Sunday, April 28, 2013

Fixing Wi-fi on HP laptop after upgrading to Windows 8

Symptoms

Charms | Settings | Network displays "Wi-Fi (Off)" with no option to turn it on

Charms | Settings | Change PC Settings | Wireless displays Wi-Fi as off and greyed so unable to turn on

Start | Type "View Network Connections" | Select Settings | Select View Network Connections displays   the Wi-Fi adapter as being "Not connected" with a Red X symbol



What worked for me

After spending ages updating software, reinstalling drivers and generally mucking around, the following finally worked for me.

Restart, press F10 to get to BIOS and reset all settings to System Defaults.

For me it's the menu on the far right. Don't forget to save the settings.

What's the cause?

Airplane mode as introduced in Windows 8 appears to screw up the ability to control Wi-Fi via the hardware button. Luckily it fixes itself when the BIOS is reset.

Wednesday, April 10, 2013

Profile unavailable in Force.com Class/Page security

Problem: when you try to add a profile to class/page security, the profile isn't available
Cause: the profile already has access to the class or page. Job already done!

Thursday, April 4, 2013

Force.com IDE - report deployment

Problem

Deploying reports using Save to Server in Eclipse appears to work ok, but the report is not updated.

Solution


Use Deploy to Server instead. This will report deployment errors, whereas Save to Server doesn't.

It appears they use different logic behind the scenes!

Sunday, March 31, 2013

Missing templates and other stuff from Visual Studio 2012?

You probably installed it as non-administrator. Rerun the installation as administrator, and repair.

Friday, February 1, 2013

Force.com IDE connect timeout

Symptom

Using the Eclipse Force.com IDE and unable to connect to Salesforce with error message "connect: timeout"

Possible Cause

Very out of date Force.com IDE

I discovered this problem when attempting to use Eclipse on a PC that had not been used for this purpose for over a year.

There have been two recent required Force.com IDE project updates - Spring 12 and Winter 13.

It appears that if a project is out of date by more than one required update then a project update dialog won't appear prompting the user to update their projects. This results in error messages when trying to connect to Salesforce because the projects are out of date.

Resolution

Update the Force.com IDE (Help | Check for Updates, then follow instructions).

Once the Force.com IDE has been updated, the user will then be prompted to update projects to Winter 13, after which this error should go away.

Wednesday, October 24, 2012

Display Inaccessible Objects to (Salesforce) Portal Users

This post was rescued from the cache for posterity.

Display Inaccessible Objects to (Salesforce) Portal Users

by Clint Lee on June 28th, 2011
It’s quite late, and I can’t think of anything particularly clever to say, so I’ll just get straight to the point.
If you’ve ever built a custom portal using Salesforce Sites then you’ve most likely had to navigate your way through the various portal licenses at some point. Let’s see, there’s a Customer Portal, a High Volume Customer Portal, an Authenticated Sites, and perhaps another one. Oh yeah, then there’s the Public Site profile.  Each license has its own nuances – object access, CRUD permissions, cost.  Inevitably you’ll need to decide on the license type that best fits what you’re trying to do, knowing that you might have to concede something down the road as you hit a gotcha! or two.
I came across a particular situation where I needed to display information from the Account object to the user.  The Site being built utilized the Authenticated Sites portal license (which provides user authentication but requires a lot of development since it requires only Visualforce pages).  Unfortunately, the Authenticated Sites license doesn’t provide the user with access to the Account object.  When I say no access I mean they can’t even read it.  So, a workaround ensued…
The following solution is not particularly mind-blowing, or really even that sophisticated, but it works for displaying data in what could be termed as “inaccessible” objects.  These are objects that Authenticated Sites licensees can’t read like Accounts, Opportunities, and Cases.  Enter….(drumroll, please)…the Wrapper Class.  Yes, folks, the Wrapper Class.  To most, this was probably obvious from the start but for me it took some noodling around.  Therefore, I decided to share in an effort to prevent others like me from noodling for too long.
Go ahead and create a wrapper class for your object, like so. Name it whatever you like. I call mine AccountToString b/c it sounds fancy.
public class AccountToString {
    private Account acct;

    public AccountToString(Account acct) {
           this.acct = acct;
    }

    public String getName() {
           return acct.Name;
    }

    public String getAddress() {
           return acct.BillingAddress;
    }

    public String getCity() {
           return acct.BillingCity;
    }

    public String getState() {
           return acct.BillingState;
    }

    public String getZip() {
           return acct.BillingPostalCode;
    }

}
Write a controller method to turn your accounts into AccountToStrings. I needed a table with Account data so I populated a class variable with a list of AccountToStrings. Here’s an example.
// This method could run in the controller's constructor.
public void findAccounts() {
           List accts = [select Id, Name, BillingAddress, BillingCity, BillingState, BillingPostalCode from Account];
           for(Account a : accts) {
                 AccountToString aString = new AccountToString( Name = a.Name, BillingAddress = a.BillingAddress, BillingCity = a.BillingCity, BillingState = a.BillingState, BillingPostalCode = a.BillingPostalCode);
                 aStringList.add(aString); // aStringList is a public class variable
           }
Finally, in your Visualforce page, this is one way that you could access your list of AccountToStrings.

    
        
             
                  Account Name
                  
             
             
                  Address
                  
             
             
                  City
                  
             
             
                  State
                  
             
             
                  Zip
                  
             
          
     

I hope this makes sense and perhaps saves you some time. As always, I look forward to any comments or feedback.