Replacing your Apex Triggers with Processes and Invocable Actions

In Salesforce by Alex0 Comments

Triggers are great, they let you react to pretty much anything that happens to your records in Salesforce in also any way that you want.

There are a few things that are not so great about triggers though, the main two being:

  • You can’t control the order in which they execute.
  • Disabling triggers requires creating a Change Set, updating tests and deploying.

Both of these can be overcome by leveraging the power of Process Builder and the @InvocableMethod annotation to create Invocable Actions instead of using Triggers.

Read More

Embrace the Power of the aura:systemError Event

In Salesforce by Alex0 Comments

If you’ve done any serious development with Lightning then you’ll know that the way it swallows JavaScript errors that would normally appear in the console can be really frustrating.

By making use of the aura:systemError event though you can make your life a heck of a lot easier.

Read More

Writing True Unit Tests using Dependency Injection and Mocking in Apex

In Salesforce by Alex0 Comments

Dependency Injection and Inversion of Control are all the rage these days even though the concept is very simple and has been around a long time, with frameworks such as Spring and Angular promoting this approach to application development.

Dependency Injection and Inversion of Control don’t require a framework to implement though, and you can get a lot of the benefits of both in Apex with a small amount of extra effort and planning when writing your code.

Read More

Variable Scope in Apex

In Salesforce by Alex0 Comments

At some point all of us have seen “Compile Error: Variable does not exist” when saving an Apex class. One of the most common causes of this (after forgetting to create the variable in the first place) is an issue with the scope of the variable.

Variable scope is a concept that I’ve found new programmers (or programmers coming from environments with different scoping rules) often struggle with. I’ve put together some examples that clarify how variable scope works in Apex.

Read More

#StruckbyLightning

In Salesforce by Alex0 Comments

Last week Salesforce made a global announcement introducing the new Lightning Experience which was broadcast live from San Francisco to Developer and User Groups around the world. In case you missed out you can re-watch the broadcast on Salesforce.com.

What the whole announcement boils down to is this – Salesforce as you know (and maybe love) it is getting a huge facelift. The Salesforce Classic (aka. Aloha) UI that we all use every day is on the way out and a new era of Lightning is being ushered in, but what does that mean for you?

Read More

Using Named Credentials in Apex

In Salesforce by Alex1 Comment

Almost every Salesforce Org will make use of a third party web service for something. It could be something as simple as posting to Twitter, to a complex integration with a third party orders and payments system.

The new Named Credentials feature streamlines and simplify the process of using authenticating with third party web services within Apex code.

Read More

Say Hello to @testSetup in Spring ’15

In Salesforce by Alex0 Comments

Anyone who has developed for the Salesforce platform knows how important testing is.

The Spring ’12 (API version 24.0) release introduced the isolation of test data from organization data in unit tests which really shook things up.

Now the Spring ’15 (API version 33.0) release is here and whilst the change introduced is not quite as revolutionary it will make a big difference to the way you write your tests.

Read More

Why You Should Become An Implementation Expert

In Salesforce by Alex0 Comments

As a developer, you’re probably thinking that the only Salesforce certifications that will be useful to you are the Force.com Developer and Force.com Advanced Developer. I’m going to explain why you are wrong.

I’ve recently studied for, sat, and passed the Sales Cloud Consultant exam and I’m currently working towards the Service Cloud Consultant exam. I think that doing so has made me a better Salesforce developer, and it can do the same for you too.

Read More