Skip to content

Dave Helgerson

Salesforce Software Development and Consulting

Menu
  • Contact
  • Resume
Menu

Category: Apex

Salesforce Apex programming language

Get Record Type ID by Name for a Salesforce Object

January 14, 2018October 12, 2022

Salesforce provides an Apex method for retrieving an object’s record type record id. The method accepts the record type label instead of the developer/api name, and this makes the Apex method sensitive record type label changes. Here is a typical example of the method in use. It strings together methods for the object’s schema, record…

Read more
Categories: Apex / Salesforce

Convert a number to a string left padded with 0s in Apex

November 5, 2017November 5, 2017

Integer MyInt = 54; String MyString = String.valueOf(MyInt).leftPad(5, ‘0’); system.assertEquals(‘00054’, MyString);

Read more
Categories: Apex / Salesforce

Apex File Naming Standards

April 5, 2016April 10, 2016

Consistent file naming helps keep Visualforce and Apex classes easy to recognize and find. I’ve seen many orgs with both the good and the bad. Below is a table with naming suggestions. Some of them are mine, but most came from a presentation that I found referenced in a Trailhead module. The presentation is by…

Read more
Categories: Apex

Remove Last Comma or Other Characters from the End of a String

March 28, 2015March 28, 2015

Apex Removing the last comma is often needed when dynamically building a SOQL Select string. Salesforce quietly released a bunch of new string methods in Winter ’13 that I have started to really appreciate. One of the new methods is removeEnd() and removeEndIngoreCase(). These are great for removing that last comma. String soql = ‘Select…

Read more
Categories: Apex / JavaScript / Salesforce

Salesforce Describe Methods – Record Types, Fields, and Global Describe

September 6, 2014November 23, 2018

Record Type Describe Getting an object’s record type Id is simple with the statement below, and it avoids using a SOQL statment on the RecordType object. However, the method name is misleading because getRecordTypeInfosByName actually retrieves the record type with the Label and not the Name. Also, be careful because the name is case sensitive….

Read more
Categories: Apex / Development / Salesforce
  • 1
  • 2
  • 3
  • 4
  • Next
Super Clone Pro
© 2023 Dave Helgerson | Powered by Minimalist Blog WordPress Theme