
WELCOME TO SALESFORCEDEMYSTIFIED
Naturally Curious
SalesforceDemystified endeavors to simplify the concepts in Salesforce. And I love having the opportunity to share my passions and thoughts with my loyal readers. Read on, and enjoy.
Http callout to an endpoint using Apex
//when the callout endpoint's url and authentication settings are done in the remote settings HttpRequest req = new HttpRequest();...
Features included in Testing framework
create unit tests run unit tests run only code marked as tests check the test result check code coverage that should be minimum 75...
Automate Test Execution (For Free)
Six Tips to Great Unit Tests https://developer.salesforce.com/blogs/developer-relations/2016/07/six-tips-great-unit-tests.html Tests run...
To prevent SOQL injection
Use the following: SOQL injection - a SOQL injection attack can be used by attackers to access otherwise restricted data in your...
How to apply lightning stylesheet onto Visualforce page?
Add the attribute lightningStylesheets="true" in the <apex:page> Put all visualforce elements in the html body - <body...
Visualforce page in a dashboard
<apex:page controller="retrieveCase" tabStyle="Case"> <apex:pageBlock> {!contactName}'s Cases <apex:pageBlockTable value="{!cases}"...
Listing data on Visualforce with customized look n feel
datatable <!-- For this example to render fully, associate the page with a valid account record in the URL. For example:...
Use static query instead of dynamic query
Eg of dynmic query: String query = 'select id from account where name = \'' + name + '\''; List<Account> queryResult =...
How to assign leads and cases using round robin?
use case: assign them equally to the existing members. For eg, if there are 3 members, assign the first lead to member1, second lead to...
To share a record using Apex
Use case: suppose that you are building a recruiting application and have an object called Job. You want to validate that the recruiter...
Use of transient variable
use case - everytime a page is requested the datetime variable is updated. Solution: declare the datetime variable as transient. public...
When to use Trigger.oldMap & Trigger.newMap?
use case: If the opportunity has been changed to 'Closed Won' then check the checkbox. Solution: Trigger.new returns a list, which are...
Trigger should not contain logic, it should delegate to handler class
Eg: trigger trgOp on Opportunity (before delete, before insert, before update, after delete, after insert, after update){ OpTrgHandler...
When a caught exception is thrown again?
It is primarily useful when the method is called by another method and the exception handling is transferred to the caller method. Eg:...
Bulkify code to sit within the governors' limits.
use case: When a contact is inserted or updated, its field State__c should be updated with the state where its postal code matches with...
Why use Apex Properties vs normal getter & setter?
An Apex property is similar to a variable. Use case # 1: Properties can be used to validate data before a change is made. Eg: <apex:page...
Apex Email Service
Use Case: When an email is received from a client, a task should be created against the contact record with the email matching the 'from...
How to deploy an app from GITHub to Dev Sandbox?
Authorize your Trailhead Playground or Developer org and provide it with an alias (mydevorg in the command below): sfdx...
Dynamic Apex
It gives the ability to: Access sObject and field describe information Describe information provides metadata information about sObject...


