Posts

Master-Detail and Lookup relationships in Salesforce

Image
In Salesforce, Master-Detail and Lookup relationships establish relationships between objects. Here's an explanation of each: Dependency and Data Integrity: Master-Detail Relationship: Child records are tightly bound to parent records. If a parent record is deleted, all associated child records are deleted. This ensures strong data integrity and dependency between records. Lookup Relationship: Child records can exist independently of parent records. Deleting a parent record does not automatically delete associated child records. This offers more flexibility but results in weaker data integrity than Master-Detail relationships. Ownership and Control: Master-Detail Relationship: The parent object owns the relationship, and the child object is subordinate. The child record inherits security and sharing settings from the parent record. Master-detail relationships are typically used for objects with a clear parent-child relationship where the parent owns the child's records. Lookup ...

Visualforce Best Practices

Visualforce is a powerful framework for building user interfaces in Salesforce applications. Here are some best practices to keep in mind when working with Visualforce: Best Practices for Improving Visualforce Performance Best Practices for Accessing Component IDs Best Practices for Static Resources Best Practices for Controllers and Controller Extensions Best Practices for Using Component Facets Best Practices for Page Block Components Best Practices for Rendering PDF Files Rendering a Visualforce page as a PDF file is a great way to share information about your Salesforce organization. Here are some best practices for you to consider. Best Practices for <apex:panelbar> Documentation Typographical Conventions 

Salesforce MVC Architecture

Salesforce MVC Architecture Salesforce uses a Model-View-Controller (MVC) architecture, which is a software design pattern that separates the representation of information (the model) from the user's interaction with it (the view and the controller) Salesforce Platform Architecture The Salesforce platform uses a multi-tenant, metadata-driven architecture, which allows for high customization and extensibility.  This architecture includes: A single instance of the Salesforce kernel that serves all tenants Tenant-specific metadata that is used to dynamically materialize applications Comprehensive testing and deployment processes to ensure reliability Overall, Salesforce's MVC architecture, combined with its multi-tenant, metadata-driven platform, enables the development of highly customizable, scalable, and maintainable applications. Key Components of Salesforce MVC: Model (Database Layer) : The schema and data in Salesforce, represented by sObjects (Salesforce objects). This is t...

Apex Page Message in Visualforce

To display a page message on a Visualforce page, you can use the <apex:pageMessages> component. This component is typically used to display messages to users, such as validation errors, informational messages, or confirmation messages. Here's how you can use it: <apex:page controller="YourControllerName">     <!-- Your Visualforce page content goes here -->          <!-- Page messages section -->     <apex:pageMessages /> </apex:page> Within your Apex controller or controller extension, you can add messages to be displayed using the Apex addError() method. For example: public class YourControllerName {     public PageReference yourActionMethod() {         // Perform some action                  // Add a message         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Your message here.')); ...

What Is Visualforce Tabs?

Tabs in vf page are used to display content like the way standard tabs do. Each tab do consist of its individual section, which is display some content. To create a tab like view, we use <apex:tabPanel> and <apex:tab> tags. Example code for Tabs in Visualforce <apex:page> <apex:tabPanel switchType="client"> <apex:tab label="Tab 1"> <!-- Content for Tab 1 --> </apex:tab> <apex:tab label="Tab 2"> <!-- Content for Tab 2 --> </apex:tab> <apex:tab label="Tab 3"> <!-- Content for Tab 3 --> </apex:tab> </apex:tabPanel> </apex:page> In this <apex:tabPanel> tag is used in which each <apex:tab> tag consist of information to be displayed in the tab.

Order of Execution in a Visualforce Page

In Visualforce, the order of execution refers to the sequence in which various components and actions are processed when a Visualforce page is loaded and rendered. Understanding this order is crucial for developers to control the behavior and appearance of their Visualforce pages effectively. Here's the typical order of execution: Component Initialization: First, any components defined in the Visualforce page are initialized. This includes standard components like <apex:page>, <apex:form>, and custom components. Controller Initialization: If the Visualforce page has a controller or controller extension associated with it, the constructor of the controller(s) is executed. This allows the controller to initialize any necessary data or perform any required setup operations. Getter Methods Execution: After the controller is initialized, getter methods defined in the controller are executed. Getter methods are responsible for providing data to the Visualforce page, typically...

What are Custom Controllers , Custom List Controller and Controller Extensions?

A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user. Example <apex:page controller="myController" tabStyle="Account">     <apex:form>         <apex:pageBlock title="Congratulations {!$User.FirstName}">             You belong to Account Name: <apex:inputField value="{!account.name}"/>             <apex:commandButton action="{!save}" value="save"/>         </apex:pageBlock>     </apex:form> </apex:page> public class MyController {     private final Account account;     public MyController() {         account = [SELECT Id, Name, Site FROM Acco...