Posts

Showing posts from February, 2019
Image
Connect Dropbox with Salesforce as IdP An identity provider is a system entity that creates, maintains, and manages identity information for principals while providing authentication services to relying applications. An identity provider is “a trusted provider that lets you use single sign-on (SSO) to access other websites". When you log into trailhead by clicking 'Log in with Facebook', 'Log in with Google+' or 'Log in with Linkedin' then that's the example of Google, Facebook, Linkedin acting as trusted identity provider, and authenticating you on behalf of trailhead. Identity provider saves your time spent in creating and maintaining your credentials and helping third party websites from storing and protecting your information. Salesforce supports   Identity provided-initiated login - when Salesforce logs in to a server provider at the initiation of the end user. Service provider-initiated login - when the service provider requests S...
Image
Apex Service Layer : Separation of Concerns Separation of Concerns (SoC) (modularity,information hiding) The most important principle of Software is Separation of Concerns(SoC).Software system must be decomposed into parts that overlap in functionality. Separation of Concerns is a design principle for separating a program into different sections so that each section addresses a separate concern (information). A program which implements SoC is consider as modular program. Modularity is achieved by encapsulation. Encapsulating means information hiding. SoC results in simplified and easy maintenance of code which later help reusing the code and easy to upgrade, i.e. one can modify one piece of code without knowing the details of other section of code. Good code benefits from careful design and foresight and complex code gets out of hand if you don't partition it properly. When code is heavily intermixed, it become error prone, difficult to maintain and hard to learn. Benef...
Image
Reset Password button missing for Community Users If you are created a community user and you don't see 'Reset Password' button on user detail record then one of the reason of missing button is that you might not have added that user to community as member. Steps to add the Community User: 1. Go to Setup. 2. Search 'All Communities' in Quick Find. 3. Click on workspaces link next to community. 4. Click on Administration. 5. Select Members from left panel 6. Select the user's profile and click on Add.
Image
Lightning Tooltip A lightning:helptext component displays an icon with a popover containing a small amount of text describing an element on screen. The popover is displayed when you hover or focus on the icon that's attached to it. By default, the tooltip uses the utility:info icon but you can specify a different icon with the iconName attribute.  Visit   https://lightningdesignsystem.com/icons/#utility   to view the utility icons. Let's create tooltip component and will try to make it  reusable. LightningToolTipcmp Above Lightning tooltip component can be reused by passing the help text as a attribute. Reference:  Lightning Web Components
Image
CAPTCHA in Lightning Use below code to implement captcha in your lightning component. Lightning_CAPTCH.cmp Lightning_CAPTCHController.js Lightning_CAPTCHHelper.js Add caption
Image
Pagination in Lightning In this blog we will implement pagination in Lightning.  PaginationController.cls LightningPagination.cmp LightningPaginationController.js LightningPaginationHelper.js
Image
instanceof in Apex If we need to verify at runtime whether an object is actually an instance of a particular class use instanceof keyword.  The  instanceof  keyword can only be used to verify if the target type in the expression on the right of the keyword is a viable alternative for the declared type of the expression on the left. You could have something which is passed as Object type and using instanceof you can determine if it is an instance of your class or other data types below code will help understand the use instanceof keyword. Open developer console and run below code and observe the logs InstanceofController.getType(new Account()); INstanceofController.getType(true); INstanceofController.getType(Id.valueOf('001xa000003DIlo')); InstanceofController.getType(Date.newInstance(2020, 12, 31)); InstanceofController.getType(DateTime.newInstance(2020, 12, 31,0,0,0)); InstanceofController.getType('Clever Fox'); InstanceofController.getType(Blob.valueo...
Image
Virtual Class in Apex A class that extends another class inherits all the methods and properties of the extended class. In addition extending class can override the existing virtual methods by using override keyword in the method definition. Overriding a virtual method allows you to provide a different implementation for an existing method. This means that the behavior of a particular method is different based on the object you're calling it. This is referred as  polymorphism . just like abstract class, it is not mandatory to override virtual methods. virtual and abstract classes can extends virtual class. Check below code Now open developer console and run below code snippet and observe the logs Marker obj1, obj2; obj1 = new Marker(); // This outputs 'MARKER: writing some text' obj1.write(); obj2 = new BlueMarker(); // This outputs 'BLUEMARKER: writing some text using BlueMarker' obj2.write(); // We get the price of marker // and can call it fr...
Image
Interface Class in Apex Interface is similar to class, it can have methods and variables and methods are default abstract (method with abstract keyword, only declaration not body). Interface is been used for total abstraction. Difference between interface and abstract class. Abstract Class Interface Class Use abstract keyword to declare abstract class. Use interface keyword to declare interface An abstract class can be extended using keyword "extends". As interface class can be implemented using keyword "implements". You can define constructors in abstract class. Interface cannot have any constructors. Abstract class can have metho...
Image
Abstract Class Use in Apex abstract keyword is used to create a abstract class and method. Abstract class cannot be instantiated. An abstract class is mostly used to provide a base for sub-classes to extend and implements the abstract methods and override or use the implemented methods in abstract class. Abstract classes are classes which have at-least one method declared as abstract(method with keyword abstract). When you instantiate a class extending abstract class, first abstract class constructor is called then constructor of child get called. Lets create Abstract class and extends it Now go to Developer console and run below code and observe the output in debug logs. Calculator cal = new Calculator(); cal.Calculate(10,20); below is the output: Note:   1. You cannot directly call the abstract class constructor i.e. if you tried to run below code you will get an error. AbstractController abst = new AbstractController(); 2. A child c...