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
Posted on May 20, 2019 Leave a Comment
Here is the problem statement: Given an expectedSum value find the sum (n+ (n+1) = expectedValue) from a list that equals the expectedSum. I am using the following list 1,3,4,4,5,9 and looking for the sum to be 8 (3+5, 4+4) *Note the list is sorted Solution 1: The above time complexity for a nested for […]
Posted on May 17, 2019 Leave a Comment
The Salesforce Security review require that both: Object Level (OLS) Field Level (FLS) Security is applied for the following areas: Query of data – Selectors Triggers – Domains DML – Unit of Work To check both (OLS) and FLS we can use fflib_SecurityUtils it has all the to methods to check if a user can access […]
Posted on May 16, 2019 Leave a Comment
Consider the following problem: Write a short program that prints each number from 1 to 100 in one line For each multiple of 3, print “Fizz” instead of the number. For each multiple of 5, print “Buzz” instead of the number. For numbers which are multiples of both 3 and 5, print “FizzBuzz” instead of […]
Posted on April 6, 2019 Leave a Comment
When uploading a new FeedItem we want to share it to a specific community. First thing we need to do is share the FeedItem to a community by sharing it to the User. As the documentation states: Only feed items with a Group or User parent can set a NetworkId or a null value for […]
Posted on April 2, 2019 Leave a Comment
If you are testing active assignment rules you need to add it as an DMLOptions during testing else your assignment rule(s) will not get called and your assertion(s) may fail. If you have one active Case Assignment Rule you can use dmlOpts.assignmentRuleHeader.useDefaultRule = true else you need to query for AssignmentRules. To query AssignmentRules you […]
Posted on March 26, 2019 Leave a Comment
We can run 3 batch jobs sequentially by incrementing the jobCounter and passing the integer (job index) into the batch scope This can be increased to any amount of batch jobs, the problem I solved was able to update the Contact and disable Users in the same code running as different batch job. As you […]
Posted on February 18, 2019 Leave a Comment
Sorting a list of Analysis messages first by boolean and then integer. First we will order by condition and then order. All records where condition is true is will be on top in descending order on top followed by all false condition in descending order. SummaryAnalysisMessages object to sort Compare object by condition and then […]