Posts

Showing posts from 2018

MultiPicklist Lightning Experience Problem Solved

Image
When we create a Visualforce Page and in which we can use Multipicklist. It work well in Salesforce Classic but somehow not work in Lightning Experience. We can say a small bug in Salesforce. But every problem has a solution. So, here is the solution below: Demo Video : https://youtu.be/OwWT2WkrsiY Apex Class public class MultipicklistSelect{     public list<SelectOption> lstHobbiesOption {get;set;}     public Account acc {get;set;}     public List<String> lstSelectedHobbies {get;set;}             public MultipicklistSelect(){         fetchTrainedBy();         acc = new Account();         lstSelectedHobbies = new List<String>();     }         public void fetchTrainedBy(){           ...

Bulkify Trigger Example

Trigger : Update Account Total_Amount field  by sum of all its Contact Money field (Roll up summary trigger) For this following steps as follow: 1. Create custom field Create a custom field on Account named :  Total Money Create a custom field on Contact named :  Money 2. Create a Apex Class (Handler class for Trigger) named :  AccountTotalMoneyHandler public class AccountTotalMoneyHandler{          public static void onAfterInsert(List<Contact> lstNewContacts){         Set<Id> setAccountIds= new Set<Id>();         for(Contact con : lstNewContacts){             if(con.AccountId != NULL){                 setAccountIds.add(con.AccountId);             }         }         if(setAccountIds.size() > 0){  ...

DIFFERENCE BETWEEN SET, LIST AND MAP

Three different types of collections in Apex. List Set Map List : List simply called collection of duplicate values and which contains Integer indexed data. Create new  LIST . List<String> myList = new List<String>(); Add into  LIST . myList.add(‘Navin’); myList = new List<String>{ ‘Navin’, ‘Aryan’ }; Duplicate means? myList.add(‘Navin’); myList.add(‘Aryan’); myList.add(‘Navin’); Here the size of LIST is 3 . We can get this by myList .size() At index 0, myList[0] = we get Navin At index 1, myList[1] = we get Aryan At index 2, myList[2] = we get Navin Set : Set simply called collection of Unique values and cannot be sort. Create new SET. Set<String> mySet = new Set<String>(); Add into Set. mySet .add(‘Navin’); mySet = new mySet <String>{ ‘Navin’, ‘Aryan’ }; Unique means? mySet.add(‘Navin’); mySet.add(‘Aryan’); mySet.add(‘Navin’); Here the size of SET is 2 . We can get this...