apex Category

Salesforce System Integration Interview Prep

Remote Process Invocation – Request and Reply Best solutions External Services – invokes a REST API call – allows to invoke externally hosted service in declarative manner. External REST service are available in a an OpenAPI or Integrant schema definition. Contains primitive data types, nested objects not supported. Transaction invoked from Lightning Flow. Integration transaction […]

Rate this:

Read More

Salesforce Platform Events, Change Data Capture, Real-Time Event Monitoring explained

Below details the different Salesforce events types for different use cases 1. Change Data Capture Select the entities that generate change event notifications. Change Data Capture sends notifications for created, updated, deleted, and undeleted records. All custom objects and a subset of standard objects are supported. /data/AccountChangeEvent – any changes to accounts Create account Update […]

Rate this:

Read More

Apex Rest API Architecture – Best Practices

What’s a Service/API A service/API is a function that is well-defined, self-contained, and does not depend on the context or state of other services. 1. Abstract vs Concrete When developing software we often use abstraction and polymorphism to get most of our applications. We want to reuse as much of the code as possible. Should […]

Rate this:

Read More

Apex Coding Interview Challenge #3

Coding question asked by Google Develop a Trigger on asset to count the amount of assets for a specific account. The value of the asset should increate on insert or undeleteand decrease on delete or reparent to a new account. Assumption: an asset cannot have a null AccountId, validation rule will fail and not save the record. […]

Rate this:

Read More

Apex SFDC99 Final Project Challenge Solution

Here is a fun Apex challenge to test your Apex skills: SFDC99 Final Project Challenge! Optimizations: 1. Add static variables to custom variables/custom metadata 2. Cache mapOfZipOwner for faster retrieval + less SOQL queries Assumption: updating an account owner can only be when: 1. Zip code was empty (null) and now has a value 2. […]

Rate this:

Read More

Apex extend standard objects to add business logic

Currently it is not possible to extend a standard or custom object in Salesforce. Why would you want to do that you may ask, think about the following, how would you check the age of a contact, if they have a mobilephone, sort list of objects, serialize, deserialize, . Define an Obj class that will […]

Rate this:

Read More

Apex Coding Interview Challenge #5

Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer. DecodeHelper class DecodeHelper Test

Rate this:

Read More

Apex Coding Interview Challenge #4

Coding question asked by Google Find the top most parent accountId by traversing the account hierarchy Recursive method Batch class Test class

Rate this:

Read More

Apex passing parameters to Batch job during scheduling

Here it the use case: You have 1 job that you want to run weekly and monthly but the monthly job also has to generate a notification. You don’t need to create two classes but can pass a parameter to the schedule to know it is a weekly or monthly job. The batch Job class […]

Rate this:

Read More

Apex Cache Tracker to remove session cache

Here is the problem that needed to be solved: 1. Use session cache to cache some user information like their profile or user settings 2. When a external systems update the information and try to remove the session cache as it got updated it fails because it does not have access to a users session […]

Rate this:

Read More