Category Archives: Salesforce

Items relating to Salesforce

Helpful Salesforce Addons & Tools

Here are Salesforce Addons & Tools that I use. If you use others, please share in the comments.

Declarative Lookup Rollup Summary – This is an open source Salesforce managed package that lets one declaritively define a rollup-summary on a lookup or master-detail. It aggregates a value from child records onto a parent record using the configuration defined. This was originally developed by Andy Fawcett and now has many contributors.

Metadata API Apex Wrapper – This Salesforce managed package lets one call the Salesforce Metadata API from Salesforce using Apex. By allowing creating, updating, or deleting metadata programmatically, this opens up more declarative possibilities from Salesforce natively. For example, creating triggers and apex classes from Visualforce and Lightning pages or automating the install or uninstall of packages.

Workbench – A website hosted by Salesforce that has various utilities for admins and developers. Examples include a SOQL query builder, REST explorer, Schema browser, and bulk data exporter and importer.

Salesforce Boostr – :rocket: Boostr Chrome extension for Salesforce.com. Started by mattsimonis in February, 2016, this extension provides various useful enhancements to the Salesforce UI when logged in. Examples include clearing out the text in the Admin Search’s textbox and showing the number of fields selected on the field history tracking page. Salesforce Boostr Chrome Extension Link

Happy Coding,

Luke

Get Salesforce Certified?

There are quite a few Salesforce certifications. Should you get Salesforce certified though?

It Depends

As a developer, becoming Developer and Advanced Developer certified has helped by

– Broadening my Salesforce knowledge base. Much of my time is spent writing Apex, Visualforce, Triggers, and Objects. The certifications cover other topics such as security, declarative capabilities like Workflows, Process Builder, and Visual Flows, Approval Processes, and other things.

– Increased Marketability. Many of the Salesforce Developer job postings list Developer or Advanced Developer certification as a requirement. After becoming Advanced Developer certified, more recruiters contacted me despite not searching for a job.

– Staying Current. With each major Salesforce release, which happens 3 times a year, a maintenance exam is taken to remain certified. The exam questions are from each release so it ensures one stays current with Salesforce.

– AppExchange Visibility. If you work for an ISV or are one yourself, being developer certified increases the certification count on the AppExchange listing page.

Considerations

1) Difficult Exams. Many of the certification exams are multiple choice with a required passing rate of 67% or higher. However, the questions are difficult because they’re very direct and you either know the answer or you don’t.

2) Relevant. Ensure that the certification will be relevant to what you’re doing. If one doesn’t plan on working with the Service Cloud, becoming Service Cloud Consultant certified isn’t useful.

3) Investment. Getting certified takes time and money. For example, the Advanced Developer certification took around 60 hours to complete between the exam, programming assignment, written exam, and studying. It also costs a few hundred dollars. The Technical Architect exam costs around $6,000.

If you’re certified, would you recommend others to do so too? What other considerations and benefits have you seen from being certified?

Luke

Variable Binding in Dynamic SOQL

Are you used to writing Apex like the following for building a dynamic SOQL query in Salesforce? If so, read on for a better way.

Variable Binding: A Better Way

Using Variable Binding, there’s no more need to build the “IdInClause” anymore. The equivalent Apex code using Variable Binding is:

This code is cleaner and takes less time to execute. Variable Binding also prevents SOQL injection natively without the use of the escapeSingleQuotes() string function to cleanse string input.

Variable Binding does have limitations, however. It can’t bind directly against functions in the query string like

It also can’t bind against fields on sObjects like

Both cases can still be done by assigning the value(s) to a variable first and then binding against that in the query.

Happy Coding,

Luke

Invalid Cross Reference Id Error

Getting the “Invalid Cross Reference Id” Salesforce error and unsure what it means? If so, that error means that the Salesforce Id used in a lookup or master-detail relationship field is not valid.

Causes

1) Wrong Object Type – The relationship field is being set to the Salesforce Id of the wrong object. For example, if field A is a lookup to the Account object, an opportunity Id can’t be used in this field.

2) Record Deleted – The record no longer exists. This can happen if someone deleted the record while a user or the system is inserting or updating records. It can also happen during a request when the record is initially inserted but then rolled back so the code still has a reference to the record with an id in memory but the record does not exist in the database.

3) Relationship Field Pointing To Wrong Object – This happens less frequently but is still a cause of this error. Sometimes, there are multiple objects in the system with the same name and a user chose the wrong object to have the lookup or master-detail point to. This happens because Salesforce will show the same object name without any further detail in the object list when defining the field so it’s not immediately clear which to choose.

To choose the correct object when there are multiple with the same name, inspect the drop down list in the browser and view the values for the select list items. Identify the correct one to use and then choose it from the drop down list.

If this information has helped or if you have other causes, please comment below.

Happy Coding,

Luke