Posts

Working with Large Sets of Data

Visualforce custom controllers and controller extensions are subject to Apex governor limits. For more information about governor limits, see Execution Governors and Limits . Additionally, Visualforce iteration components, such as <apex:pageBlockTable> and <apex:repeat>, are limited to a maximum of 1,000 items in the collection they iterate over. Sometimes your Visualforce pages may need to work with or display larger sets of data, but not need to make modifications to that data; for example, if you are providing custom reporting and analytics. Visualforce offers developers a “read-only mode”, which relaxes the limit on the number of rows which can be queried in one request, and increases the limit on the number of collection items which can be iterated over within the page. You can specify read-only mode either for an entire page or, with certain limitations, on individual components or methods. Note - You can only iterate over large sets of data if you specify read-only ...

Rendering PDF Files Using Visualforce Page

Rendering PDF files using a Visualforce page in Salesforce is a common requirement, especially when you need to generate printable documents such as reports, invoices, or statements. Salesforce provides a way to generate PDF files directly from Visualforce pages using the renderAs attribute.    Visualforce <apex:page controller="PDFRenderingController" renderAs="pdf">   <apex:form >     <apex:pageBlock >         <apex:pageBlockTable value="{!accList}" var="acc" border="2">            <apex:column value="{!acc.Name}"/>            <apex:column value="{!acc.AnnualRevenue}"/>            <apex:column value="{!acc.Type}"/>            <apex:column value="{!acc.AccountNumber}"/>            <apex:column value="{!acc.Rating}"/>       ...

Wrapper Class in Apex Salesforce

A wrapper class in Salesforce Apex is a custom class that allows you to combine different types of data into a single object. It's particularly useful when you need to work with complex data structures or display multiple pieces of information in a Visualforce page.  Wrapper classes are commonly used in scenarios like: Visualforce Pages : You can use wrapper classes to display data from multiple related objects in a single table or form on a Visualforce page. Apex Controllers : Wrapper classes can be used to pass complex data structures between Apex controllers and Visualforce pages. Lightning Components : In Lightning development, wrapper classes are often used to format data for display in Lightning components or to simplify the structure of data passed between components. Integration : When working with external systems or APIs, wrapper classes can help structure data in a way that's easier to work with in Apex code. Here's an example of how you can use a wrapper class w...

Mass Updating Records with a Custom Controller Using Visualforce Page

Here's an example illustrating these steps: Controller public with sharing class MassUpdateController {     public List<MyObject__c> records { get; set; }     public Set<Id> selectedIds { get; set; }     public MassUpdateController() {         // Fetch records to display         records = [SELECT Id, Name, Active__c FROM Agent__c LIMIT 10];         selectedIds = new Set<Id>();     }     // Method to handle the mass update operation     public PageReference performMassUpdate() {         List< Agent__c > recordsToUpdate = new List< Agent__c >();         // Fetch selected records to update         for (Agent__c record : records) {             if (selectedIds.contains(record.Id)) {                 // ...

Integrating Visualforce and Google Charts

Integrating Visualforce with Google Charts allows you to create dynamic and visually appealing charts within your Salesforce environment. Visualforce is Salesforce's markup language for building custom user interfaces, and Google Charts is a powerful visualization library provided by Google. Here's a basic guide on how to integrate Visualforce with Google Charts: <!-- MyChartPage.page --> <apex:page controller="ChartController">     <apex:includeScript value="https://www.gstatic.com/charts/loader.js"/>     <script>         google.charts.load('current', {'packages':['corechart']});         google.charts.setOnLoadCallback(drawChart);         function drawChart() {             var data = google.visualization.arrayToDataTable({!chartData});             var options = {                 title:...

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...*/ ...