Category: Certification

Sorting Arrays in JavaScript

 Like any programming language, JavaScript also provides ways to sort arrays. Different JavaScript engines implement this method using different sort algorithms. For example -Safari: Quicksort, Merge Sort, or Selection SortV8: Quicksort, or Insertion SortFirefox: Merge SortBut in reality, it doesn’t really matter much as long as the arrays are getting sorted.Note – I am putting my JavaScript Developer study notes here. The prototype for Sort method available in Array class is:Array.sort([compareFunction])Normally a callback function is passed which makes the sorting logic i.e. how the two numbers will be compared. This callback function should take two parameters i.e. param1 and param2 and works like this -callback function will return zero when both param1 and param2 are treated as equalcallback function will return 1 when both param1 is smaller than param2 callback function will return 11 when both param2 is smaller than param1Note – In default sorting, param1 and param2 are always converted into Strings and then they will be sorted alphabetically.For example, if we consider the below examplelet numbers = [100, 23, 45, 12, 99];let sortedNumbers = numbers.sort();console.log(sortedNumbers);Output: [ 100, 12, 23, 45, 99 ]But that’s not the correct sorting. The reason behind is that numbers here are converted into Strings and then sorted alphabetically due to default sorting.To solve this we need to pass the callback function which will define the comparison logic. Below is the modified code -let numbers = [100, 23, 45, 12, 99];let...

Read More

All About Asynchronous Apex

While studying for the Salesforce Platform Developer II certification, I was going through the different options Apex provides to run Apex code asynchronously. This post is all about sharing the study notes with key points to remember.Apex provides four options to run code asynchronously. Future Method, Queueable Apex, Batch Apex and Scheduled Apex.Future MethodsMethods are annotated with @future annotation.Future methods should be static and can only return void type.It supports parameters, but parameters should be primitive data types, arrays of primitive data types, or collection. sObjects or objects cannot be used as parameters to future methods.These methods run in their own thread and will only start when the resources are available.They are used for long running operations and prevent any delay in apex transaction.They can be used for callouts to external web services and also separating DML operations to prevent Mixed DML error.Future methods should not be used for processing large amount of data. In that case, Batch Apex should be used.To test future methods, enclose test code between startTest and stopTest test methods.Future methods not necessarity execute in the same order as they are called.Future methods cannot be used inside Visualforce controllers getter, setter, constructor methods.Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htmhttps://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_future_methodsQueueable ApexApex code must implement Queueable interace.By implementing Queueable interface, Apex class can be added to the job queue and it will run when the system resources are available.The difference between Queueable Apex...

Read More

Important points to remember regarding actionRegion, actionFunction, actionSupport, actionPoller

Last night(July 17th, 2019) while preparing for Platform Developer II certification, I was going through my notes to revise the different ways to call Apex Controller functions from Visualforce page, I thought of making a post regarding actionRegion, actionFunction, actionSupport, actionPoller & actionStatus. Just setting the expectation beforehand – It is not a post which will explain you all, but I will share the developer guide link for each of them so that you can go and read them (highly recommended).actionRegionThe specifies the components to be processed on Force.com server. Without this tag, the whole page will be processed. With actionRegion also the whole form is submitted, but only the part within the tag will be processed.It needs a reRender attribute to be effective. It will only refresh the part of the page using the data contained within the tag. This can be very effectively used to avoid validation errors that may occur due to present of standard validation rule in VF page like required attribute.Here is the example without ActionRegion:Controller:public with sharing class WithoutActionRegionController { public String valueEntered{get;set;} public String country{get;set;} public String state{get;set;} public WithoutActionRegionController() { country = ”; state = ”; valueEntered = ”; } public PageReference countrySubmitted(){ valueEntered = ‘Country: ‘ + country; return null; }}Visualforce Page:<apex:page controller=”WithoutActionRegionController”> <apex:form id=”myForm”> <apex:pageMessages id=”messages1″/> <apex:pageBlock id=”topPageBlock”> <apex:pageBlockSection columns=”2″ title=”Country & State”> <apex:outputText value=”Enter Country” /> <apex:inputText value=”{!country}” > <apex:actionSupport...

Read More

Notes on passing Salesforce Certified Sharing and Visibility Designer

I have cleared Salesforce Sharing and Visibility Designer certification on Jan 11th, 2019 and it helped me to become Salesforce Application Architect.Let me quickly share the Exam Outline:Total Number of Questions: 60 multiple-choice/multiple-select questions.Time: 120 minutesPassing Score: 68%Registration Fee: USD 400; Retake Fee: USD 200Prerequisite: NoneIn this blog post, I will share my notes and experience during the preparation and also during the exam. I hope it will help you in your #JourneyToCTA.To me questions were very straight forward, but very descriptive, which took a lot of time to go through the entire question. Going through the entire question is very important because one single work can totally change your answer. Before I start preparing myself, I have gone through the below blog posts which helped me to create a consolidated list which I am going to share here.How to Prepare For and PASS Sharing and Visibility Designer Exam.Preparing For The Salesforce ‘Sharing and Visibility Designer’ Exam.Salesforce Sharing & Visibility Designer Certification.Ladies Be Architect: Study Group.Below are the topics from where I have received questions:Understanding Profile and Permission DifferenceProfile is user’s base level permission and all users having the same profile will have the same permission. Permission Set is assigned to individual users on top of profiles to extend their visibility.You can set Login Ip, Hour, Session Settings, Password policies in Profiles, where these are not possible in permission sets.Profiles are...

Read More

Salesforce Enterprise Territory Management Cheat Sheet

This post is the continuation of my study notes for  Sharing and Visibility Designer Architect Certification. Previous post was regarding Salesforce Sharing and Security Cheat Sheet. Enterprise Territory Management is a very important topic and having a clear understanding will definitely going to help in passing the certification as well as implementing it for your own project.Nice to check out: Salesforce Spring 21 Release FeatureSalesforce Certification NotesSalesforce Release Video TutorialsSalesforce Lightning Flow Video TutorialsImportant Note:Original Territory Management is only available with Customizable Forecast.Enterprise Territory Management works with Collaborative Forecast. It will not work with Customizable Forecast.Territory:Group of Accounts and Sales reps who work for those accounts.Territory Type:This is the criteria to group territories. Every territory must have one Territory Type, but it will never appear in the Territory HierarchyTerritory Type Priority:Helps you to create priorities for your territory type.Territory Model:Creates the entire Territory Hierarchy.It allows to create multiple territory hierarchy and test that before activating.Number of territory models depends on the Salesforce edition.Territory Hierarchy:Shows the model’s territory structure.You can run assignment rules at the model level or individual territory levels.Your territory hierarchy in active territory model also determines the forecast hierarchy for territory forecast.Territory Model State:Three states – Planning, Active or Archive.Only one territory can be in Active state.Multiple territories can be in either Planning or Active state.User Access for Territory Records:Define Account access in Territory Settings when enabling the...

Read More
Loading