Search

Friday 26 April 2013

Managed Package Issues

Unit tests do not run when you install a managed package, but the code coverage of the unit tests of a managed package do affect the overall coverage of your entire unit test coverage.

Unit tests in a managed package can fail when you install a package and still the package will install, but when a package is being created all unit tests need to pass in the org that the package is created.

So unit tests of a managed package must be written well creating their own test data etc, because otherwise all other unit tests in an org may have coverage over 75% but code cannot be deployed because unit tests in managed packages are much lower than 75%

Saturday 9 March 2013

State and countries in Salesforce

This is a great video to help you convert your Countries to the new sanitised picklist Satte and Countries

http://www.youtube.com/watch?v=osSN804ILlI

Friday 1 March 2013

Problems Installing Force.com IDE


Usually Ive installed Eclipse then installed the Force.com IDE through Help > Install New Software but recently that has not been working at all.

So I followed the steps to download the standalone  Force.com IDE and then tried to upgrade Eclipse after the install and this is when all the issues started.

So if like me you have tried to follow the steps in http://wiki.developerforce.com/page/Force.com_IDE_Installation

When you come to
"Go to the HELP menu item in the IDE, select the Software and Workspace Center, and then click on the "Apply" button in the dashboard tab. You may find that the Apply button does not exist in your UI -- if so, see if you can find something on the Developer Boards."

You may find like I did that the Apply button doesn't exist

Solution

Do make sure you have downloaded the correct version of JDK 32 or 64 bit first.
Download the next to latest version of Eclipse from http://www.eclipse.org/downloads/
Extract to a separate folder than the standalone  Force.com IDE
Copy the contents of the Eclipse folder and Replace the contents of the folder where the standalone  Force.com IDE was installed.
Now restart Eclipse
Go to Help > Install New Software and this time you will be able to upgrade the Force.com IDE successfully.

Yes this is a pain but this was the only way I could get Force.com IDE to be installed if the Apply button in the Pulse Explorer doesnt exist.

Hope this helps everyone!

Saturday 19 January 2013

Schedule Jobs Pending - Salesforce Deploy


I guess we all have had this error at some point "Schedule Jobs Pending" when deploying. This is caused because what you are deploying is used directly or indirectly by classes that are scheduled.

Lets say we have a class called schedClass which is scheduled. This class uses a class called Utils. If you change the Utils class and try to deploy it you will get the error.

Solution
1. Create an interface class
public Interface IUtils {}

2. Your Utils class now implements this interface
public virtual class Utils Implements IUtils{ }

3. Create another class which instantiates a class casted as IUtils the interface class of type Utils


public class UtilsProxy {
public static Type t = Type.forName('Utils');

public static IUtils thisutil = (IUtils)t.newInstance();

public static List<List<SObject>> breakIntoDMLChunks(List<SObject> theList, Integer chunkSize){
return thisutil.breakIntoDMLChunks(theList, chunkSize);
}

The result is any code that wants to run the Utils code can do so through the interface, so when you are deploying code which uses Utils just call the methods in the UtilsProxy class instead. Job done, no more Schedule Jobs Pending.