Posted on May 12, 2020 Leave a Comment
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 […]
Posted on May 6, 2020 Leave a Comment
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. […]
Posted on April 30, 2020 Leave a Comment
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. […]
Posted on April 29, 2020 Leave a Comment
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 […]
Posted on April 29, 2020 Leave a Comment
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
Posted on September 12, 2019 Leave a Comment
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 […]
Posted on August 5, 2019 Leave a Comment
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 […]
Posted on June 4, 2019 Leave a Comment
Problem: Find the number that has the highest frequency in a list of integers. Input: 1,6,2,1,6,1 Output: 1 //because 1 occurs 3 times in the list Option 1: Use Hashmap to iterate list Option 2: Use wrapper class with compare to sort wrapper Option 3: Using buckets to group index of frequencies together
Posted on May 30, 2019 Leave a Comment
The clearOutRecords would iterate all the fields passed as the currentRecord, then: 1. Exclude the fields as part of the fieldsToExcludeForClearOut Set and relationship fields 2. Check if the field is not null and updateable 3. Special logic to set fields to predefined values 4. Set all other fields to null 5. Return the SObject […]
Posted on May 23, 2019 Leave a Comment
When you need to remove sensitive data from json before logging the following method will remove a predefined list of keywords removeAttributes method will iterate all the keys in the payload and remove the sensitive keys from the payload