Posts Tagged salesforce

Logging Salesforce errors with platform events

The following pattern is fairly common in other technologies:

  try {
  } catch (Exception e) {
    throw e;

This won’t work in salesforce. By rethrowing the exception (assuming it’s not caught further up the call stack), the database transaction will be rolled back - that includes whatever insert or update ws triggered in logException(e). So how do we ensure that the logging occurs in a separate database transaction? The answer is a platform event!

Read More

Simple Confirmation Modals in Lightning

If you’re writing custom Lightning components you’ll eventually need to get a confirmation from the user before proceeding with some action. Perhaps you’ll need to ask approval before deleting a record, or maybe you’ll need final confirmation before launching the missiles. Either way - it’s going to happen and Salesforce isn’t helping you get the job done.

Read More

HTTP Mock Registry - A Simplified Way to Mock Apex Callouts

Apex leaves much to be desired when it comes to mocking callouts to external services. Use of the HttpCalloutMock interface requires that a test author configure mock responses for ALL callouts made through the course of a test’s processing, and this can be quite unmanageable in large or complex projects. There must be a better way… Enter the HTTP Mock Registry.

Frustrated with messy tests and abstraction leaks, we’ve devised a utility that provides a intuitive interface for mocking callouts declaratively as well as a foundation for more modular test suites whenever callouts are involved.

Read More

A Better Way to Communicate from Child to Parent Aura Components

Being able to invoke methods and pass data between parent and child components is critical when building an application structure that is both extensible and easy to use.

One of the basic features of Lightning Aura components is the ability to nest components (components containing other components). Communicating from a Parent Component to a Child Component is easy with Aura.

Read More