Accessing an Apex web service from outside Salesforce

Postman logo

In this post we are going to talk about sending a request from a client that is outside Salesforce to an Apex web service in Salesforce. We are going to use the Postman client.

Salesforce Rest API

There are number of reasons you may want to interact with your instance of Salesforce from outside Salesforce. You may have an app or service that you want to allow to access your Salesforce data. In our case, we have an external call center that needs to be able to access and manipulate our Salesforce data.

We need our external call center to be able to create new Leads, update Lead information and schedule appointments. There is a lot of information online about the Salesforce REST API and Connected Apps, but it is widely distributed and can be confusing. …

Tangled pile of rope

Let’s untangle the subject of code coverage requirements for Apex Triggers on the Salesforce platform.

I recently inherited a Trigger that had been neglected for some time. The code was stringy, highly coupled and poorly tested. I added a few lines of code and tried to deploy it. It failed. The error:

0% code coverage. Each trigger must have at least 1% code coverage.

I ran the test in our production environment and in two sandboxes. It had 31 percent code coverage. …

Anaerobic Membrane Bioreactor for Continuous Lactic Acid Fermentation

Computers only know binary. Base 2 is binary. Let’s convert a couple of integers to their binary representation.

The number 10.

n = 10

n/2 = 5 with a remainder of 0, so the number in our binary string is 0.


Now n=5

n/2 is 2 with a remainder of 1.

So our number is 1.


Now n = 2

n/2 = 1 with a remainder of 0

So our number is 0.


And that leaves us with 1, which is our first number


Another representation of what we…

ones and zeros

Let’s take a minute to breakdown bitwise operators. Bitwise operators are operators that operate on ints and uints at the binary level.

< 5 Seconds on Binary

0 represents closed or off or false.

1 represents open or on or true.

The binary operators take two inputs, or arguments, and returns one output. The inputs can only be 0 or 1.


When we use the AND operator, we are effectively saying, if the first argument the second argument are true, then the result is true, or 1. Otherwise the result is false, or 0.


is an encryption algorithm, or cipher, that is the current industry standard used to encrypt/decrypt files and data transmitted over secure file transfer protocols like HTTPS, FTPS, SFTP etc.

Screenshot of encrypt/decrypt code

While complicated on a number of levels, in the era of high-level programming languages and frameworks, encryption is not difficult to implement. …

Salesforce, like the Internet, was built on the fly and in retrospect we probably should have done things differently. While Apex and Visualforce provide a lot of functionality and convenience, some things should just be easier. Enter <apex:inputField /> and <apex:inputText /> and <apex:input />.

Scenario 1: Capture text data and bind it to a sObject

No problem. We can use <apex:inputField />:

<apex:inputField value="{! Account.FirstName }" 
html-placeholder="First Name" />

Scenario 2: Capture date and bind it to a sObject

No problem. We can use the same component and just add type="date":

<apex:inputField value="{! Account.PersonBirthDate }"
html-placeholder="Birth Date"
type="date" />

Orcs from The Lord of the Rings films

Most of us interact with REST APIs on a regular basis, but from time-to-time we need to interact with SOAP APIs as well. For those of us with less exposure to SOAP, REST APIs are like the Shire and SOAP APIs are a little like Mordor. They are dark and scary and full or orcs.

A SOAP message is not as bad as it looks. …

Salesforce has built-in validations that can be applied to specific fields, but these validations are somewhat rigid and limited. When searching for programatic solutions there seemed to be confusion and hesitancy regarding using triggers and custom validations. Once I figured out the solution, however, I found that they are relatively easy to build and limitless in versatility.

Two reasons to build custom validations are extensibility and searchability. We can add features and conditions to our validation at a later date. Additionally, everything is the codebase is easily searchable which makes debugging a less painful task. header

Postman is a clean, easy-to-use REST client, but it also works well for sending SOAP message via HTTP. Configuring Postman for a SOAP request is similar to a REST configuration.

For the purpose of this walkthrough we’ll use a mock company called Robot Lenders. We will send a SOAP request, or message, containing applicant information for a loan pre-qualification.


We’ll submit a POST request to the Robot Lenders API using the following URL and endpoint: of

Kris Sparks

Software developer. Turing School alum.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store