How to write APEX Triggers and What are the best practices?

Apex triggers allows you to perform some actions when any record is created, updated, deleted or undeleted in Salesforce. What can we do using triggers? A trigger can perform following actions: Insert, Update, Delete records. Update fields from child to parent and vice-versa. Send Emails to record owner, external user, contact & lead etc. Call…

How to use SOSL query to search in multiple Salesforce objects?

SOSL is the Salesforce Object Search Language. We can search words, phrases or text with wildcard characters in multiple standard and Custom objects in Salesfore. Unlike ‘SELECT’ command in SOQL, we will use ‘FIND’  command to search in SOSL query. SOSL statements evaluate to a list of lists of sObjects, where each list contains the search results…

How to query data using SOQL and display on a Visualfroce page using PageBlockTable ?

We can query data using SOQL and display on a Visualforce page. Let’s display Account and related Opportunities by passing id of an account in the URL. We will query all Opportunities related to the Account using SOQL in Apex, and display data on Visualforce page using PageBlockTable. Create a Visualforce page using following code: Visualforce Page: Name: {!Account.Name}…