Salesforce

Get code coverage using REST API query

Let’s suppose you need to find all the classes or triggers starting with “MY_” and having 0 lines covered. The REST API query we need would be as follows:

Obviously, it will return a JSON string with the classes and triggers which match the criteria. There are a lot of online tools to view […]

Salesforce

Salesforce Winter 17 Highlights

We already have a new version of our loved CRM & Platform. Once again over 300 new features are released and it is a litte bit overwhelming to go over all of them. Just to highlight the most important ones for me and that we cannot miss, I’ll list them. Ligthning enhancements: Lightning Data Service […]

Salesforce

Retrieving blob objects from Azure with Apex

Maybe you need to retrieve blobs stored in Azure Storage Services and save them as Salesforce attachments. Let’s suppose we have an attachment base64 encoded stored as a blob in Azure. We could retrieve it with the following snippet:

Salesforce

Named credentials using OAuth

Sometimes you need to use the Rest API in your Apex Code to make callouts to other Salesforce Orgs or even to the same Org where you are executing your code. You could use Named Credentials to avoid storing user and password credentials (normally in an unsecure way) with OAuth. We will need the following […]

Salesforce

CreatedDate in test classes

Finally Salesforce fills the gap and allows you to specify the createddate field within test classes. You only have to use the Test.setCreatedDate method introduced with Spring ’16.

Better late than never!

Salesforce

Spring ’16

Spring ’16 release is already among us. I was able to attend the 4 webcasts where the most important features were presented with nice demonstrations. I recommend you to join the Release Readiness Chatter group. There are very interesting documents, including the release notes for this release but also for past and future releases. Once […]

Salesforce

Manage UserTerritory table through REST API

UserTerritory is one of the few objects that don’t allow DML Operations. However, we can manage it through the REST API. We could assign a User to a Territory by using the following APEX code:

If you want to remove a user from a territory, then the APEX code would looks like the following: […]

Salesforce

Defensive future calls

I would like to talk about the wonderful and simple pattern for making future calls. This pattern was presented by Dan Appleman at one of his sessions at Dreamforce this year. It looks like this:

Simple but very effective. To provide you a quick example. Let’s suppose we have a Session object and a […]

www.000webhost.com