When you are going through loop in a trigger you don’t have access to Record Type name like RecordType.Name, you can only access Id as RecordTypeId. Here’s the solution.
Salesforce – How can I get the code coverage of a class / org?
To get code coverage of a class or all classes you can use Tooling API on objects like:
- ApexCodeCoverage – contains coverage per class per test class
- ApexCodeCoverageAggregate – contains coverage per class for all test classes
- ApexOrgWideCoverage – contains coverage overall for all classes in the org
The best way is run queries using Developer Console
Salesforce – How to list all scheduled jobs in Apex?
Winter ’14 introduced the ability to receive name and type in Apex and SOQL queries. We can use CronJobDetail relationship to get the job’s name and type. Here are examples:
Salesforce – Audit Trail Parser
When I was preparing my first change set, I was a bit surprised that I couldn’t get information about what was changed recently. Then I learned that there is Audit Trail which stores this kind of information as a changelog.
So I prepared a tool where you can upload a CSV file (from View Audit Trail section) and it will show you the changes made in the system (changed Apex classes, VF pages, objects, fields, profiles etc.).
Salesforce – How to access State and Country Picklists values in Apex?
Salesforce provides a native way to use country and state values in Account and Contact address fields. It’s very useful on page layouts. But what if we want access that values and use them in our Apex Class and Visualforce Page?
Here is a sample code retrieve those values and use Map to store them.
Salesforce – How to access Owner custom fields in a SOQL query?
Today I came across a problem with accessing Owner custom fields (for the User object I had several of these fields). I only could access few standard fields like Owner.Name, Owner.FirstName without problems. But here’s how I solved it.
Salesforce – How to create tab for Tasks / Events in Classic UI?
Sometimes we would like to have easy access to all our tasks. We can browse some of them on the Home page, but it’s not always an efficient way. Instead of that, we would like to have them as a tab and view them on the whole screen.
Salesforce – How to get translated values of picklist and Record Types in Apex?
When we create an application that uses multiple languages, we use translation workbench is the purpose of the translation. Salesforce takes care of the translation user interface, so we always got the right language. But what about picklist values in Apex?
Salesforce – How to retrieve list of Chatter Files related to a record?
Files associated with a record can be stored in 2 ways: as an attachment (in the Notes & Attachments related list) as well as Salesforce Content (using Chatter Files).
Recently I had a task to create Visualforce pages, which put on the Page Layout as inline Visualforce showed the files posted by Chatter Files associated with the record. Adding files was carried out by the Chatter. Assigning Topics to an entry in Chatter allowed to filter files by this as a category.