DEV 501 Notes:

DEV 501 Quick Notes

#Referred from another blog. Quick notes to take before Advanced Developer certification exam: Would be useful for all developers.

ReadOnly Annotation prevents you from performing the following operations within the request:
DML operation, system.schedule method,calls to future method,sending emails


To increase other Visualforce-specific limits, such as the size of a collection that can be used by an iteration
component like <apex:pageBlockTable>, you can set the readonly attribute on the <apex:page> tag to true.


class defined with @isTest should not be interface or enums.


future annotation:


Method with future annotation cannot be used in getter,setter,constructor methods
Future annotated methods must be defined as static and can return only void return type.


Map Key can hold null value.


Methods with the RemoteAction annotation must be static and either global or public.


Static methods and variables can only be declared in a top-level class definition, not in an inner class.


Classes can be declared as enums but does not require class keyword in declaration


Unlike Java, the enum type itself has no constructor syntax.


protected access modifier-This means that the method or variable is visible to any inner classes in the defining Apex class, and to the classes that
extend the defining Apex class


You can only use static methods and variables with outer classes. Inner classes have no static methods or variables.


If a local variable is named the same as the class name, these static methods and variables are hidden.


The instance initialization code in a class is executed every time an object is instantiated from that class. These code blocks
run before the constructor.


Apex properties cannot be defined on interface.


To use an interface, another class must implement it by providing a body for all of the methods contained in the interface.


Only class extends from abstract or virtual classes can use super. you can only use super in methods that are designated with override keyword.

With Sharing:


Inner classes do not inherit the sharing setting from their container class.
Classes inherit this setting from a parent class when one class extends or implements another.


Exception classes must extend either exception or another user-defined exception


Default access level for inner class is private.


Even with with sharing class all CURD and field level security are ignored


Apex support both top level and inner interfaces.


To implement an interface all methods should be defined.


This keyword is not available for top level classes but available for attributes and methods.


Only instance methods and member attributes can use protected method.


System methods are examples of static methods.


Constructor does not have any explicit return type.


System methods:
       System.Now() - Returns the time in GMT
System.today()- returns the date in current user's timezone
System.assert(),
System.AssertEquals()- Compares two argument and optional message
System.AssertnotEquals().
System.debug()


UserInfo class:
               getUserId(), getUsername(),getUserRole(),getFirstname(),getLocale(),getLanguage(),getSessionId()


Limit class:


getDMLRows() returns the number of rows processed.
getLimitDMLRows() returns the total resource available from the current context.
getDMLStatements
getheapSize
getQueries
getQueryRows
getScriptStatements


Data Types in apex: Primitives, Sobjects, Collections, enums, objects created from user-defined or system supplied apex class.


The apex array is dynamic, but java array is static

If field history is enabled for an object the data which is getting stored in field history will be anyType.

Enum data type methods:
ordinal():- returns the position of item in the list
Name():- returns the name of the enum item as a string
values():- static method that returns the list of values


SaveResult object has 3 methods.
1.Id getId()
2.List<Database.Error> getErrors()
3.Booleab isSuccess()


If the DML operation contains only one record we can use saveResult instead of list<SaveResult>.
External field contains externalid attribute.
Execution of setsavePoint(), rollback() counts against the total number of DML statements.


----------Apex Library Classes-------


You cannot add isdeleted flag into page layout.
Trigger by definition will not receive more than 200 records in trigger.new
each DML statement can only operate on one type of sobject at a time.
Merging limited to 3 records at a time and its limited to leads, accounts, contacts.


If there are uncaught exceptions while performing DML operations then system will roll back.


SavePoint sp = database.setSavepoint();
Database.rollback(sp);


Approval Process:-
ProcessRequest ,ProcessSubmitRequest, ProcessWorkItemRequest.
ProcessRequest is a parent class for both ProcessSubmitRequest and ProcessWorkItemRequest.
Approval process should be defined for approval process through apex.


Webservice , remoteaction methods cannot overloaded,


Apex cannot access file system or create temporary files in salesforce.


Sobject clone method has 4 parameters
1.preserve id
2.deepclone - All fields on the sObject are duplicated in memory, including relationship fields
3.Readonly timestamps - Determines whether the read-only timestamp fields are preserved or cleared in the duplicate.
4.preserve_autonumber - Determines whether auto number fields of the original object are preserved or cleared in the duplicate.


Sobject toString method returns the object values into string.


Apex sharing can be set only for custom objects, but standrad objects can be shared with apex. The sharing reason for standard objects
will always be manual.


if history tracking is enabled then Object__history object will be created automatically for that custom object.
full,read,read/write, write sharing are there for an object. Full is granted only for record owners.


Interfaces are implicitly virtual, so no need to define virtual keyword for interfaces.


Organization wide sharing changes will remove the redundant sharing records.


Inner class behave like static java inner class.


Virtual keyword used to extends or override the class and methods.


Abstract keyword used if the class contains incomplete implementations.


Global classes are used for Email service,webserivce and AppExchange products.


Schema.DescribeFieldResult F = Account.AccountNumber.getDescribe();
Schema.DescribeFieldResult F = Schema.SObjectType.Account.fields.Name;


Map<String, Schema.SObjectField> M = Schema.SObjectType.Account.fields.getMap();
Schema.DescribeSobjectResult[] results = Schema.describeSObjects(types);//It can have 100 objects as argument to it.


Accessing all Sobjects:-
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();


In dynamic soql you can use bind variable in query string, but you cannot use sobject field as bind variable in dynamic soql.
DML operation always require list of sobjects, list<object> will not support in DML.


Salesforce automatically recalculates sharing for all records on an object when its organization-wide sharing default access level
changes. The recalculation adds Force.com managed sharing when appropriate. In addition, all types of sharing are removed if the
access they grant is considered redundant.


Apex sharing reasons and Apex managed sharing recalculation are only available for custom objects.


-----------Developer console------------------
An anonymous block is Apex code that does not get stored in the metadata, but that can be compiled and executed using one
of the following:
• Developer Console
• Force.com IDE
• The executeAnonymous SOAP API call:


Note the following about the content of an anonymous block (for executeAnonymous, the code String):


• Can include user-defined methods and exceptions.
• User-defined methods cannot include the keyword static.
• You do not have to manually commit any database changes.
• If your Apex trigger completes successfully, any database changes are automatically committed. If your Apex trigger does
not complete successfully, any changes made to the database are rolled back.


• Unlike classes and triggers, anonymous blocks execute as the current user and can fail to compile if the code violates the
user's object- and field-level permissions.


• Do not have a scope other than local. For example, though it is legal to use the global access modifier, it has no meaning.
The scope of the method is limited to the anonymous block.


• When you define a class or interface (a custom type) in an anonymous block, the class or interface is considered virtual by
default when the anonymous block executes. This is true even if your custom type wasn’t defined with the virtual
modifier. Save your class or interface in Salesforce to avoid this from happening. Note that classes and interfaces defined
in an anonymous block aren’t saved in your organization.


The return result for anonymous blocks includes:
• Status information for the compile and execute phases of the call, including any errors that occur
• The debug log content, including the output of any calls to the System.debug method
• The Apex stack trace of any uncaught code execution exceptions, including the class, method, and line number for each call stack element

---------------Trigger--------------


Trigger.new is used only by insert and update triggers.
You can only use the webService keyword in a trigger when it is in a method defined as asynchronous; that is,
when the method is defined with the @future keyword.


The code block of a trigger cannot contain the static keyword. Triggers can only contain keywords applicable to an inner class.


If any record that fires a trigger includes an invalid field value (for example, a formula that divides by zero),
that value is set to null in the new, newMap, old, and oldMap trigger context variables.


Be aware of the following considerations for trigger context variables:
• trigger.new and trigger.old cannot be used in Apex DML operations.
• You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown.
• trigger.old is always read-only.
• You cannot delete trigger.new.


In before delete trigger you can update field values of object using DML statements, not using trigger.new.
In after undelete you can update the field values using DML statements.


You cannot use Trigger.new to update field values in any after triggers.
you can update the fields on object using trigger.new in before trigger if there are new version of sobject being created in trigger.


The after undelete trigger events only run on top-level objects.


The getContent and getContentAsPDF PageReference methods aren't allowed in triggers.

Methods with the future annotation have the following limits:
• No more than 10 method calls per Apex invocation
• The maximum number of future method invocations per a 24-hour period is 250,000 or the number of user licenses in
your organization multiplied by 200, whichever is greater


You can only have 100 scheduled Apex jobs at one time.


To schedule an Apex class to run at regular intervals, first write an Apex class that implements the Salesforce-provided interface
Schedulable interface.


The Schedulable interface contains one method that must be implemented, execute.
global void execute(SchedulableContext sc){}
The implemented method must be declared as global or public.


Cron trigger schedule string syntax:
Seconds Minutes Hours Day_of_month Month Day_of_week optional_year


You can't use the getContent and getContentAsPDF PageReference methods in scheduled Apex.


Scheduling example:


scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
String jobID = system.schedule('Merge Job', sch, m);


batchable b = new batchable();
database.executebatch(b);


bothe of the above method needs to implement schedulabe interface.


An easier way to schedule a batch job is to call the System.scheduleBatch method without having to implement the Schedulable interfce.
System.scheduleBatch(reassign, 'job example', 1);


To obtain the total count of all Apex scheduled jobs, excluding all other scheduled job types, perform the following query.
Note the value '7' is specified for the job type, which corresponds to the scheduled Apex job type.
SELECT COUNT() FROM CronTrigger WHERE CronJobDetail.JobType = '7'


Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make an
asynchronous callout by placing the callout in a method annotated with @future(callout=true) and call this method
from scheduled Apex.


You can only have five queued or active batch jobs at one time


To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition. For example:
global class SearchAndReplace implements Database.Batchable<sObject>,
Database.AllowsCallouts{
}


A maximum of 50 million records can be returned in the Database.QueryLocator object.


Each batch Apex invocation creates an AsyncApexJob record. Use the ID of this record to construct a SOQL query to
retrieve the job’s status, number of errors, progress, and submitter.


When using the webService keyword, keep the following considerations in mind:
• You cannot use the webService keyword when defining a class. However, you can use it to define top-level, outer class
methods, and methods of an inner class.
• You cannot use the webService keyword to define an interface, or to define an interface's methods and variables.
• System-defined enums cannot be used in Web service methods.
• You cannot use the webService keyword in a trigger because you cannot define a method in a trigger.
• All classes that contain methods defined with the webService keyword must be declared as global. If a method or
inner class is declared as global, the outer, top-level class must also be defined as global.
• Methods defined with the webService keyword are inherently global. These methods can be used by any Apex code that
has access to the class. You can consider the webService keyword as a type of access modifier that enables more access
than global.
• You must define any method that uses the webService keyword as static.
• You cannot deprecate webService methods or variables in managed package code.
• Because there are no SOAP analogs for certain Apex elements, methods defined with the webService keyword cannot
take the following elements as parameters. While these elements can be used within the method, they also cannot be
marked as return values.
◊ Maps
◊ Sets
◊ Pattern objects
◊ Matcher objects
◊ Exception objects


• You must use the webService keyword with any member variables that you want to expose as part of a Web service. You
should not mark these member variables as static.
• Salesforce denies access to Web service and executeanonymous requests from an AppExchange package that has
Restricted access.
• Apex classes and triggers saved (compiled) using API version 15.0 and higher produce a runtime error if you assign a String
value that is too long for the field.


To implement an email service apex class should implement Messaging.InboundEmailHandler
The apex class should be global for inboundEmailHandler.

Eg:

global class CreateTaskEmailExample implements Messaging.InboundEmailHandler
{
global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env)
{
}
}



Common exception Methods


Userdefined exceptions name should end with string Exception.


Here are descriptions of some useful methods:
• getCause: Returns the cause of the exception as an exception object.
• getLineNumber: Returns the line number from where the exception was thrown.
• getMessage: Returns the error message that displays for the user.
• getStackTraceString: Returns the stack trace as a string.
• getTypeName: Returns the type of exception, such as DmlException, ListException, MathException, and so on.
* initcause(SobjectException) this method sets the cause for the exception, if not set already.
Methods with DML in their name are supported only for DML exceptions.
Most DML exception methods take integer parameter fro the failed row number.
getDMLFields(int),getDMLIndex(int),getDMLMessage(int),getDMLStatusCode(int),getnumDml()





TESTING


Unit test methods take no arguments, commit no data to the database, send no emails, and are flagged with the
testMethod keyword or the isTest annotation in the method definition. Also, test methods must be defined in test
classes, that is, classes annotated with isTest.


Test methods should be static.


To load test data from static resource
List<sObject> ls = Test.loadData(Account.sObjectType, 'testAccounts');


The runAs method doesn’t enforce user permissions or field-level permissions, only record sharing.
Every call to runAs counts against the total number of DML statements issued in the process.


Anonimous block cannot use the keyword static




---------------------VISUALFOECE-------------------------------------

View State tab displays only on pages using custom controllers or controller
extensions.

Redirecting to standard list view: <apex:page action="{!URLFOR($Action.Account.List, $ObjectType.Account)}"/>


Components that support inline editing must always be descendants of the <apex:form> tag. However, the <apex:detail>
component doesn’t have to be a descendant of an <apex:form> to support inline editing.

<apex:page standardController="Account">
<apex:detail subject="{!account.Id}" relatedList="false" inlineEdit="true"/>
</apex:page>


<apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />


You can reference query string parameters in Visualforce markup by using the $CurrentPage global variable
$CurrentPage.parameters.parameter_name


<apex:stylesheet> tag doesn't have a rendered attribute, you'll need to wrap it in a component that does.
If a stylesheet has an empty string in a url value, you won’t be able to render that page as a PDF. For
example, the style rule body { background-image: url(""); } will prevent any page that includes it from
being rendered as a PDF.


QuickSave action doesnot redirect the user to record detail page.
list action returns -Returns a PageReference object of the standard list page, based on the most recently used list
filter for that object.


Returns a PageReference object of the standard list page, based on the most recently used list
filter for that object.


By default, a list controller returns 20 records on the page. To control the number of records displayed on each page, use a
controller extension to set the pageSize.


Creating a custom controller set records:-
public ApexPages.StandardSetController setCon
{
get
{
if(setCon == null)
{
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT Name, CloseDate FROM Opportunity]));
}
return setCon;
}
set;
}

Visualforce iteration components,such as <apex:pageBlockTable> and <apex:repeat>, are limited to a maximum of 1,000 items in the collection they
iterate over.


Visualforce pages and components created using Salesforce API version 19.0 or higher must be written as well-formed XML.


Normally, queries for a single Visualforce page request may not retrieve more than 50,000 rows. In read-only mode, this limit
is relaxed to allow querying up to 1 million rows.


$ComponentLabel
A global merge field to use when referencing the label of an inputField component on a Visualforce page that is associated with a message.


$Label
Used when referencing a custom label in a Visualforce page.


$ObjectType
The global variable is used when referencing standard or custom objects


$Setup
Used when referencing a Custom Setting of type "hierarchy."

The following table lists the ApexPages methods:


◊ addMessage
◊ addMessages
◊ getMessages
◊ hasMessages
◊ hasMessages


Cookie Class
Apex class lets a developer access cookies for a Force.com site using Apex.


<apex:actionRegion>
An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an AJAX request is generated. Only the components in the body of the < apex:actionRegion > are processed by the server, thereby increasing the performance of the page.
Note that an < apex:actionRegion > component only defines which components the server processes during a request—it does not define what area(s) of the page are re-rendered when the request completes. To control that behavior, use the rerender attribute on an < apex:actionSupport >, < apex:actionPoller >, < apex:commandButton >, < apex:commandLink >, < apex:tab >, or < apex:tabPanel > component.

<apex:actionStatus>
A component that displays the status of an AJAX update request. An AJAX request can either be in progress or complete.This support facesets to indicate the status of ajax request.


<apex:dataList>
An ordered or unordered list of values that is defined by iterating over a set of data. The body of the < apex:dataList > component specifies how a single item should appear in the list. The data set can include up to 1,000 items. rows attribute, The maximum number of items to display in the list. If not specified, this value defaults to 0, which displays all possible list items


A deployment connection alone doesn't enable change sets to be sent between organizations. Each organization must be
authorized to send and receive change sets.


Full sandbox can be used for :


Testing external integrations, Staging and user-acceptance testing,Production  debugging


Data Loader is strictly a tool for loading data, not metadata. You can’t add or delete fields on an object or load any kind of setup changes.


Data Loader is supported for loads of up to 5 million records.

----------GLOBAL VARIABLES--------------


Use global variables to reference general information about the current user and your organization on a page.
Global variables must be referenced using Visualforce expression syntax to be evaluated, for example, {!$User.Name}.
$Action
A global merge field type to use when referencing standard Salesforce actions such as displaying the Accounts tab home page, creating new accounts, editing accounts, and deleting accounts.
$Api
A global merge field type to use when referencing API URLs.
$Component
A global merge field type to use when referencing a Visualforce component.
$ComponentLabel
A global merge field to use when referencing the label of an inputField component on a Visualforce page that is associated with a message.
$CurrentPage
A global merge field type to use when referencing the current Visualforce page or page request.
$FieldSet
Provides access to a field set defined in your organization.
$Label
A global merge field type to use when referencing a custom label in a Visualforce page.
$Label.Site
A global merge field type to use when referencing a standard Sites label in a Visualforce page. Like all standard labels, the text will display based on the user’s language and locale.
$ObjectType
A global merge field type to use when referencing standard or custom objects (such as Accounts, Cases, or Opportunities) and the values of their fields.
$Organization
A global merge field type to use when referencing information about your company profile. Use organization merge fields to reference your organization’s city, fax, ID, or other details.
$Page
A global merge field type to use when referencing a Visualforce page.
$Profile
A global merge field type to use when referencing information about the current user’s profile. Use profile merge fields to reference information about the user’s profile such as license type or name.
$Resource
A global merge field type to use when referencing an existing static resource by name in a Visualforce page. You can also use resource merge fields in URLFOR functions to reference a particular file in a static resource archive.
$SControl
A global merge field type to use when referencing an existing custom s-control by name. This merge field type results in a URL to a page where the s-control executes.
$Setup
A global merge field type to use when referencing a custom setting of type “hierarchy.”
$Site
A global merge field type to use when referencing information about the current Force.com site.
$System.OriginDateTime
A global merge field that represents the literal value of 1900-01-01 00:00:00.
$User
A global merge field type to use when referencing information about the current user. User merge fields can reference information about the user such as alias, title, and ID.
$User.UITheme and $User.UIThemeDisplayed
These global merge fields identify the Salesforce look and feel a user sees on a given Web page.
$UserRole
A global merge field type to use when referencing information about the current user’s role. Role merge fields can reference information such as role name, description, and ID.

Test Methods
---------------------------------------------
The following are methods for Test. All methods are static.
isRunningTest()
Returns true if the currently executing code was called by code contained in a test method, false otherwise. Use this method if you need to run different code depending on whether it was being called from a test.
loadData(Schema.SObjectType, String)
Inserts test records from the specified static resource .csv file and for the specified sObject type, and returns a list of the inserted sObjects.
setCurrentPage(PageReference)
A Visualforce test method that sets the current PageReference for the controller.
setCurrentPageReference(PageReference)
A Visualforce test method that sets the current PageReference for the controller.
setFixedSearchResults(ID[])
Defines a list of fixed search results to be returned by all subsequent SOSL statements in a test method.
setMock(Type, Object)
Sets the response mock mode and instructs the Apex runtime to send a mock response whenever a callout is made through the HTTP classes or the auto-generated code from WSDLs.
setReadOnlyApplicationMode(Boolean)
Sets the application mode for an organization to read-only in an Apex test to simulate read-only mode during Salesforce upgrades and downtimes. The application mode is reset to the default mode at the end of each Apex test run.
startTest()
Marks the point in your test code when your test actually begins. Use this method when you are testing governor limits.
stopTest()
Marks the point in your test code when your test ends. Use this method in conjunction with the startTest method.
testInstall(InstallHandler, Version, Boolean)
Tests the implementation of the InstallHandler interface, used for specifying a post install script in packages. Tests will run as the test initiator in the development environment.
testUninstall(UninstallHandler)
Tests the implementation of the UninstallHandler interface, used for specifying an uninstall script in packages. Tests will run as the test initiator in the development environment.

StandardController Methods
----------------------------
The following are methods for StandardController. All are instance methods.
addFields(List<String>)
When a Visualforce page is loaded, the fields accessible to the page are based on the fields referenced in the Visualforce markup. This method adds a reference to each field specified in fieldNames so that the controller can explicitly access those fields as well.
cancel()
Returns the PageReference of the cancel page.
delete()
Deletes record and returns the PageReference of the delete page.
edit()
Returns the PageReference of the standard edit page.
getId()
Returns the ID of the record that is currently in context, based on the value of the id query string parameter in the Visualforce page URL.
getRecord()
Returns the record that is currently in context, based on the value of the id query string parameter in the Visualforce page URL.
reset()
Forces the controller to reacquire access to newly referenced fields. Any changes made to the record prior to this method call are discarded.
save()
Saves changes and returns the updated PageReference.
view()
Returns the PageReference object of the standard detail page.


Limits Methods
------------------------
The following are methods for Limits. All methods are static.
getAggregateQueries()
Returns the number of aggregate queries that have been processed with any SOQL query statement.
getLimitAggregateQueries()
Returns the total number of aggregate queries that can be processed with SOQL query statements.
getCallouts()
Returns the number of Web service statements that have been processed.
getLimitCallouts()
Returns the total number of Web service statements that can be processed.
getChildRelationshipsDescribes()
Returns the number of child relationship objects that have been returned.
getLimitChildRelationshipsDescribes()
Returns the total number of child relationship objects that can be returned.
getCpuTime()
Returns the CPU time (in milliseconds) accumulated on the Salesforce servers in the current transaction.
getLimitCpuTime()
Returns the time limit (in milliseconds) of CPU usage in the current transaction.
getDMLRows()
Returns the number of records that have been processed with any statement that counts against DML limits, such as DML statements, the Database.emptyRecycleBin method, and other methods.
getLimitDMLRows()
Returns the total number of records that can be processed with any statement that counts against DML limits, such as DML statements, the database.EmptyRecycleBin method, and other methods.
getDMLStatements()
Returns the number of DML statements (such as insert, update or the database.EmptyRecycleBin method) that have been called.
getLimitDMLStatements()
Returns the total number of DML statements or the database.EmptyRecycleBin methods that can be called.
getEmailInvocations()
Returns the number of email invocations (such as sendEmail) that have been called.
getLimitEmailInvocations()
Returns the total number of email invocation (such as sendEmail) that can be called.
getFieldsDescribes()
Returns the number of field describe calls that have been made.
getLimitFieldsDescribes()
Returns the total number of field describe calls that can be made.
getFieldSetsDescribes()
Returns the number of field set describe calls that have been made.
getLimitFieldSetsDescribes()
Returns the total number of field set describe calls that can be made.
getFindSimilarCalls()
This method is deprecated. Returns the same value as getSoslQueries. The number of findSimilar methods is no longer a separate limit, but is tracked as the number of SOSL queries issued.
getLimitFindSimilarCalls()
This method is deprecated. Returns the same value as getLimitSoslQueries. The number of findSimilar methods is no longer a separate limit, but is tracked as the number of SOSL queries issued.
getFutureCalls()
Returns the number of methods with the future annotation that have been executed (not necessarily completed).
getLimitFutureCalls()
Returns the total number of methods with the future annotation that can be executed (not necessarily completed).
getHeapSize()
Returns the approximate amount of memory (in bytes) that has been used for the heap.
getLimitHeapSize()
Returns the total amount of memory (in bytes) that can be used for the heap.
getQueries()
Returns the number of SOQL queries that have been issued.
getLimitQueries()
Returns the total number of SOQL queries that can be issued.
getPicklistDescribes()
Returns the number of PicklistEntry objects that have been returned.
getLimitPicklistDescribes()
Returns the total number of PicklistEntry objects that can be returned.
getQueryLocatorRows()
Returns the number of records that have been returned by the Database.getQueryLocator method.
getLimitQueryLocatorRows()
Returns the total number of records that have been returned by the Database.getQueryLocator method.
getQueryRows()
Returns the number of records that have been returned by issuing SOQL queries.
getLimitQueryRows()
Returns the total number of records that can be returned by issuing SOQL queries.
getRecordTypesDescribes()
Returns the number of RecordTypeInfo objects that have been returned.
getLimitRecordTypesDescribes()
Returns the total number of RecordTypeInfo objects that can be returned.
getSoslQueries()
Returns the number of SOSL queries that have been issued.
getLimitSoslQueries()
Returns the total number of SOSL queries that can be issued.




System Methods
=====================
The following are methods for System. All methods are static.
abortJob(String)
Stops the specified job. The stopped job is still visible in the job queue in the Salesforce user interface.
assert(Boolean, Object)
Asserts that the specified condition is true. If it is not, a fatal error is returned that causes code execution to halt.
assertEquals(Object, Object, Object)
Asserts that the first two arguments are the same. If they are not, a fatal error is returned that causes code execution to halt.
assertNotEquals(Object, Object, Object)
Asserts that the first two arguments are different. If they are the same, a fatal error is returned that causes code execution to halt.
currentPageReference()
Returns a reference to the current page. This is used with Visualforce pages.
currentTimeMillis()
Returns the current time in milliseconds, which is expressed as the difference between the current time and midnight, January 1, 1970 UTC.
debug(Object)
Writes the specified message, in string format, to the execution debug log. The DEBUG log level is used.
debug(LoggingLevel, Object)
Writes the specified message, in string format, to the execution debug log with the specified log level.
getApplicationReadWriteMode()
Returns the read write mode set for an organization during Salesforce.com upgrades and downtimes.
isBatch()
Returns true if the currently executing code is invoked by a batch Apex job; false otherwise.
isFuture()
Returns true if the currently executing code is invoked by code contained in a method annotated with future; false otherwise.
isScheduled()
Returns true if the currently executing code is invoked by a scheduled Apex job; false otherwise.
now()
Returns the current date and time in the GMT time zone.
process(List<Ids>, String, String, String)
Processes the list of work item IDs.
purgeOldAsyncJobs(Date)
Deletes asynchronous Apex job records for jobs that have finished execution before the specified date with a Completed, Aborted, or Failed status, and returns the number of records deleted.
requestVersion()
Returns a two-part version that contains the major and minor version numbers of a package.
resetPassword(ID, Boolean)
Resets the password for the specified user.
runAs(System.Version)
Changes the current package version to the package version specified in the argument.
runAs(User)
Changes the current user to the specified user.
schedule(String, String, Object)
Use schedule with an Apex class that implements the Schedulable interface to schedule the class to run at the time specified by a Cron expression.
scheduleBatch(Database.Batchable, String, Integer)
Schedules a batch job to run once in the future after the specified time interval and with the specified job name.
scheduleBatch(Database.Batchable, String, Integer, Integer)
Schedules a batch job to run once in the future after the specified the time interval, with the specified job name and scope size. Returns the scheduled job ID (CronTrigger ID).
setPassword(ID, String)
Sets the password for the specified user.
submit(List<ID>, String, String)
Submits the processed approvals.
today()
Returns the current date in the current user's time zone.

ApexPages Methods
===================
The following are methods for ApexPages. All are instance methods.
addMessage(sObject)
Add a message to the current page context.
addMessages(Exception)
Adds a list of messages to the current page context based on a thrown exception.
currentPage()
Returns the current page's PageReference.
getMessages()
Returns a list of the messages associated with the current context.
hasMessages()
Returns true if there are messages associated with the current context, false otherwise.
hasMessages(ApexPages.Severity)
Returns true if messages of the specified severity exist, false otherwise.

Search.query(query_String) returns the soql for the string query.


All batch methods like start(),execute(), finish() use schedulable context object as a parameter.


Controller /extension class cannot extend interfaces.

Comments

Popular posts from this blog

List of Key Prefixes in Salesforce

SFDX Install CPQ in Scratch org