
The key points while writing a test class are: You have to start your class with @isTest annotation, then only Salesforce will consider this class as test class. Keep your class as Private, and the best practice is to name your test class as your original Class or trigger Name + ‘Test’.
Full Answer
What is list class in Salesforce?
What is List Class in Salesforce? List Class is a collection type class in Salesforce, which contains all the list method and constructors. Thanks. List method is used for all instance methods. This operates on any particular instance of list.
How to change the name of a class in Salesforce?
In the ui (Setup > Develop > Apex Classes), you can change the class name, but it won't change any of the references, so if you don't manually change all references to the class, you might start getting errors that say:
What is list controller in Salesforce?
Salesforce list controller is nothing but a controller which assist and helps you to create Visualforce pages that can act on a set of records. For an instance all the pages in Salesforce that work with the set of records like list pages, mass action pages, and related lists. It is used for the following 3.
What is costume list controller in Salesforce?
Building a Custom List Controller in Salesforce A costume list controller and standard list controller are similar to each other. Costume list controller has the power to implement apex logic that is defined to act on the set of records. A costume list controller can also be created that uses anti- and semi-joins as one of the parts of SOQL query.

How do I get a list of Apex classes in Salesforce?
From Setup, enter Apex Classes in the Quick Find box, then select Apex Classes.Click the name of the class you want to view.
What are the methods of list in Salesforce?
List Methodsadd(listElement) Adds an element to the end of the list.add(index, listElement) Inserts an element into the list at the specified index position.addAll(fromList) ... addAll(fromSet) ... clear() ... clone() ... contains(listElement) ... deepClone(preserveId, preserveReadonlyTimestamps, preserveAutonumber)More items...
What is the difference between list and Set in Salesforce?
A List is an ordered collection of elements that are distinguished by their indices. List elements can be of any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types. Whereas, Set is an unordered collection of elements that do not contain any duplicates.
What is the difference between array and list in Salesforce?
Even though the size of the previous String array is defined as one element (the number between the brackets in new String), lists are elastic and can grow as needed provided that you use the List add method to add new elements. For example, you can add two or more elements to the colors list.
What is the use of list in Salesforce?
List is a collection of elements, and they are ordered according to their insertion; elements can be of any data-type. List allows duplicate values and are referred by their indices. Output of every SOQL(Salesforce Object Query Language) query is a list.
How many records a list can hold in Salesforce?
A list can hold 1000 elements(as per the limit).
Which is better list or Set?
If the requirement is to have only unique values then Set is your best bet as any implementation of Set maintains unique values only. If there is a need to maintain the insertion order irrespective of the duplicity then List is a best option.
Can we convert list to Set in Salesforce?
The simplest way to convert List to Set in Salesforce is given below: List
Can we convert list to Set in Apex?
Converting from a List to Set, can be done using the set's constructor. List
Is Apex list same as array?
Arrays in Apex are basically the same as Lists in Apex. There is no logical distinction between the Arrays and Lists as their internal data structure and methods are also same but the array syntax is little traditional like Java.
How do I convert a string to a list in Salesforce?
Use the split method. this method will split the string using the provided regex. String str = '123, 456, 789'; List
How do I find the size of a list in Salesforce?
When referencing a list in visualforce you can directly access the size using the syntax: {! myList. size} You could then create a boolean statement in Visualforce with rendered="{! myList.
What is list list sObject in Salesforce?
Lists of sObjects can be used for bulk processing of data. You can use a list to store sObjects. Lists are useful when working with SOQL queries. SOQL queries return sObject data and this data can be stored in a list of sObjects.
How do I add a list in Salesforce?
Create a Custom List View in Salesforce ClassicClick Create New View at the top of any list page or in the Views section of any tab home page. ... Enter the view name. ... Enter a unique view name. ... Specify your filter criteria. ... Select the fields you want to display on the list view. ... Click Save.
What is an apex method?
In Apex, all primitive data type arguments, such as Integer or String, are passed into methods by value. This fact means that any changes. to the arguments exist only within the scope of the method. When the method returns, the changes to the arguments are lost.
How do I return a list in Salesforce?
0:213:53Create an Apex Class that Returns an Array or List of Strings - YouTubeYouTubeStart of suggested clipEnd of suggested clipSo now the class needs to have a public static methods called generate string alright and thisMoreSo now the class needs to have a public static methods called generate string alright and this method must return an array or a list of strings. And I must accept an income and integer as a parameter.
addAll (fromList)
Adds all of the elements in the specified list to the list that calls the method. Both lists must be of the same type.
addAll (fromSet)
Add all of the elements in specified set to the list that calls the method. The set and the list must be of the same type.
clear ()
Removes all elements from a list, consequently setting the list's length to zero.
deepClone (preserveId, preserveReadonlyTimestamps, preserveAutonumber)
Makes a duplicate copy of a list of sObject records, including the sObject records themselves.
equals (list2)
Compares this list with the specified list and returns true if both lists are equal; otherwise, returns false.
getSObjectType ()
Returns the token of the sObject type that makes up a list of sObjects.
indexOf (listElement)
Returns the index of the first occurrence of the specified element in this list. If this list does not contain the element, returns -1.
Salesforce and ServiceNow Integration Benefits
Salesforce and ServiceNow are two popular CRM systems for business owners that are used by almost every other organization. Both are the high-level feature and…
Future of Salesforce: Top 6 Predictions
Salesforce is one of the top 10 software skills trending this year. It was the first software of its kind and one of the most…
Market your Brand Like a Superstar with New Salesforce Marketing Cloud March 2020 Features
For all Salesforce lovers, New Year celebrations begin only when Salesforce release their product updates. So, it is Happy New Year for us all as…
What is list controller in Salesforce?
Salesforce list controller is nothing but a controller which assist and helps you to create Visualforce pages that can act on a set of records. For an instance all the pages in Salesforce that work with the set of records like list pages, mass action pages, and related lists. It is used for the following
What is a costume list controller?
Costume list controller has the power to implement apex logic that is defined to act on the set of records.
