The transient variables are not passed to view state and therefore not stored in View State.
Thursday, 1 March 2018
[#Blogged]Transient Keyword in Salesforce
The transient variables are not passed to view state and therefore not stored in View State.
Tuesday, 20 February 2018
[#Blogged]Granular Locking in Salesforce
Granular Locking in Salesforce
The system employs additional logic to allow multiple updates to proceed simultaneously if there is no hierarchical or other relationship between the roles or groups involved.
For example: if you trying to edit the user details but on the other hand automated process is already doing that then you are not allowed to edit.
for this we use granular locking, this will not lock the entire table but only specific data.
What are the key advantages of granular locking?
1) Groups that are in separate hierarchies can be manipulated concurrently
2) Public groups and roles that do not include territories can be manipulated concurrently
3) Users can be added concurrently to territories and public groups
4) User provisioning can occur in parallel
5) A single-long running process, such as a role delete, only blocks a small subset of operations
Benefits to customers:
Customers who frequently experience locking that restricts their ability to manage manual and automated group maintenance operations.
Enable granular locking, which attempts to lock only the modified portions of the table. This can improve the performance of the following items:
1) Adding/deleting/transferring user from a territory
2) Re-parent a territory
3) Create or delete a territory within a hierarchy
4) Adding or removing a forecast manager
Check the below link for more information
https://resources.docs.salesforce.com/sfdc/pdf/draes.pdf
Tuesday, 14 March 2017
[#Blogged]Like operator in SOQL
Like operator in SOQL
For example
listOfAccounts = [SELECT id, Name
FROM Account
WHERE Name LIKE '%test%'];
This query matches both testasish,accounttest, and test.
When you declare a method or variable as static, it's initialized only once when a class is loaded. All static member variables in a class are initialized before any object of the class is created. Indeed they aren't transmitted as part of the view state for a Visualforce page.
Using static variables will cause only one instance of the variable to be loaded when the application loads and that variable will not go out of memory until the app is closed. It holds information that is common to all instances on a class and It is shared between them instead of being created a new with each instance.
while
Transient keyword to declare instance variable that can not be saved and should not be transmitted as part of view state for visual force page.
Basically, View State is an encrypted, hidden field on a Visualforce page that keeps track of Apex controller state & Visualforce page state between server requests. This field is only generated when there is a tag present on a page.
ViewState is only used on a single page that handles postbacks. Once you redirect to the new page, the ViewState is lost.
The Whole Process of Calling is like this :
A. URL Requested
B. Apex Controller Instantiated on Server
C. Controller State Serialized & Encrypted to View State
D. Page Markup Sent to Browser & Rendered
E. View State Decrypted & Deserialized (for Postbacks)
View State Automatically keeps track of field values for you and Allows for easy AJAX functionality. In order to remove View State Error, we use 4 methods.
A. Reduce Number of Components
B. Use the transient Keyword
C. Use JavaScript Remoting
D. Use the Streaming API
References: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_transient.htm