Category: object

Class-based vs Prototype-based Programming using JavaScript

Douglas Crockford described JavaScript as the world’s most misunderstood language. Like many developers, when I started learning JavaScript, to me also, this was not a “proper” language. But I quickly understood that JavaScript comes with a rich system of object-oriented programming.There are many concepts that makes JavaScript unique, but prototype model is definitely the most important one and it creates many confusions. So having a clear understanding of prototype model is very important. And in this post, I would like to explain the concept of prototype based programming in JavaScript.The prototype based programming is a very easy to understand concept, but the source of confusion is the syntax. When a new developer looks at the JavaScript code and sees new, class or constructor it makes them think that object instantiation works the same way as other languages. But in reality, they are nothing more than syntactic sugar in JavaScript. Behind the scenes, things are working in different way. So it is very important to have a clear understanding how things works which will help you to predict their behavior.Class Based LanguageA class based language (Java, C++, C# etc.) has two important concepts:class – the interface which defines the properties and methods.entities – instantiations of the class (objects) An instance is exact same copy of the class, you cannot dynamically add/remove properties/methods from the instance as declared in the class.  You...

Read More

Display Progress Bar using Formula Field in Salesforce – No coding is required

In this post, I will show how you can create a progress bar just using formula field in Salesforce. No coding required.The requirement is that for “Job Application” object, we have a picklist called “Status” which is having the values as -Based on the value chosen in pick list, we need to display the progress bar showing the progress of Job Application. So let’s do that -Step 1 -We need to upload two image files as Static Resources first. Yellow bar -Green bar -Step 2 -Create a field called in the Job Application object which will calculate the progress based on the values chosen in the Status field. The screenshot given below -Step 3 -Create another formula field to display the progress. The detail of the field is given below -Done.!!Let’s check how our Job Application page looks like -When Status = ‘New’ -When Status = ‘Review Resume’When Status = ‘Phone Screen’When Status = ‘Schedule Interview’When Status = ‘Extend an offer’When Status = ‘Hired’ / ‘Rejected’Great. Any feedback, please let me know....

Read More