Posts

Salesforce Data collections List ,Set ,Map

In Salesforce Apex, data collections such as lists, sets, and maps are used to store and manipulate data. These collections offer different functionalities and are suited for different use cases. Here's an overview of each:  List : A list is an ordered collection of elements where each element has an index. Lists allow duplicate elements. Elements in a list can be accessed using their index. Lists are represented by the List class in Apex. Example : List<String> names = new List<String>(); names.add('Alice'); names.add('Bob'); names.add('Alice'); // Adding duplicate element System.debug(names); // Output: (Alice, Bob, Alice) Set : A set is an unordered collection of unique elements. It does not allow duplicate elements. Sets are useful when you need to ensure uniqueness and don't require the elements to be in a specific order. Sets are represented by the Set class in Apex. Example : Set<String> uniqueNames = new Set<String>(); uni...

Dynamic Menu Using JDock

Image
Show Sleek and Dynamic Menu on the Visualforce Page. jqdock is a jQuery plugin inspired by Mac .jqdock is a jQuery plugin inspired by Mac Dock Menu. jqDock   Visualforce Page <apex:page sidebar="false" showHeader="false" controller="JqueryController">  <head>    <style> bPageHeader{       display:none;   }   .heading{       background-color:#ccc;       text-align:center;   }   .data table,td,th {       border:1px solid #000;   }   </style>  <apex:includeScript value="{!$Resource.jquery}"/>  <apex:includeScript value="{!$Resource.jqDock}"/>   <style type='text/css'>  /*position and hide the menu initially - leave room for menu items to expand...*/ #page {padding-top:150px; padding-bottom:20px; width:100%;} #menu {position:absolute; top:0; left:0; width:100%; display:none;} /*dock styling...*/ /*...centre the dock...*/ ...

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.