Showing posts with label Visualforce.. Show all posts
Showing posts with label Visualforce.. Show all posts

Sunday, January 25, 2015

How to Use Apex:enhancedList tag in Visualforce Page?

How to Use Apex:enhancedList tag in Visualforce Page?

Enhanced list views on a Visualforce page

Enhanced lists are used when you want to display a specific list view for a standard or custom object, rather than having all list views available for the user to select.

This tag supports following attributes.

Attribute Name
Description
customizable
A Boolean value that specifies whether the list can be customized by the current user. If not specified, the default value is true. If this attribute is set to false, the current user will not be able to edit the list definition or change the list name, filter criteria, columns displayed, column order, or visibility. However, the current user's personal preferences can still be set, such as column width or sort order.
height
An integer value that specifies the height of the list in pixels. This value is required.

id
The database ID of the desired list view. When editing a list view definition, this ID is the 15-character string after 'fcf=' in the browser's address bar. This value is required if type is not specified.
listId
The Salesforce object for which views are displayed. This value is required if type is not specified.
oncomplete
The JavaScript that runs after the page is refreshed in the browser. Note that refreshing the page automatically calls this JavaScript, while an inline edit and subsequent save does not.
rendered
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
reRender
The ID of one or more components that are redrawn when the result of an AJAX update request returns to the client. This value can be a single ID, a comma-separated list of IDs, or a merge field expression for a list or collection of IDs. Note: When an enhancedList is rerendered through another component's rerender attribute, the enhanceList must be inside of an apex:outputPanel component that has layout attribute set to "block".
rowsPerPage
An integer value that specifies the number of rows per page. The default value is the preference of the current user. Possible values are 10, 25, 50, 100, 200. Note: If you set the value for greater than 100, a message is automatically displayed to the user, warning of the potential for performance degradation.
type
The Salesforce object for which views are displayed, for example, type="Account" or type="My_Custom_Object__c".
width
An integer value that specifies the width of the list in pixels. The default value is the available page width, or the width of the browser if the list is not displayed in the initially viewable area of the viewport.



Step 1 – Create the list view

Go to the standard or custom object and click on the Create New View next to the Go button. Create the view and click on Save. When the page has reloaded, you will notice in the url a 15 digit id has been created for your view. Copy or make a note of the id.






Step 2 – Add code to your visualforce page

Add the following bit of code to your visualforce page, replacing the listid with your id:


<apex:enhancedlist type=”Lead” height=”730″ customizable=”false” rowsPerPage=”25″ Listid=”00B30000007wesH” />

Change customizable to equal true if you want your users to be able to edit the filters on the view. Once saved, you should find your visualforce page displays an enhanced list similar in appearance to the image below.





More about Visualforce page Tags:
http://sfdcsrini.blogspot.com/2014/06/visualforce-form-tags-with-examples.html

How to Use Apex:SectionHeader tag in Visualforce Page?

How to Use Apex:SectionHeader tag in Visualforce Page?


A title bar for a page. In a standard Salesforce page, the title bar is a colored header displayed directly under the tab bar.


This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated container <div> tag.


This tag supports following attributes.

Attribute Name
Description
description
Descriptive text for the page that displays just under the colored title bar.
help
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
id
An identifier that allows the sectionHeader component to be referenced by other components in the page.
printUrl
The URL for the printable view.
rendered
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
title
The text displayed at the top of the colored title bar.
subtitle
The text displayed just under the main title in the colored title bar.


Example:

<apex:page standardController="Opportunity" tabStyle="Opportunity" sidebar="false">
    <apex:sectionHeader title="One of Your Opportunities" subtitle="Exciting !"/>
    <apex:detail subject="{!opportunity.id}" relatedList="false" title="false"/>

</apex:page>








Referencing a Static Resource in Visualforce Pages?

Referencing a Static Resource in Visualforce Pages?


The way you reference a static resource in Visualforce markup depends on whether you want to reference a stand-alone file, or whether you want to reference a file that is contained in an archive (such as a .zip or .jar file):


  • To reference a stand-alone file, use $Resource.<resource_name> as a merge field, where <resource_name> is the name you specified when you uploaded the resource. For example:
<apex:image url="{!$Resource.TestImage}" width="50" height="50"/>
                                    OR
<apex:includeScript value="{!$Resource.MyJavascriptFile}"/>
  • To reference a file in an archive, use the URLFOR function. Specify the static resource name that you provided when you uploaded the archive with the first parameter, and the path to the desired file within the archive with the second. For example:
<apex:image url="{!URLFOR($Resource.TestZip,'images/Bluehills.jpg')}" width="50" height="50"/>
                                       OR
<apex:includeScript value="{!URLFOR($Resource.LibraryJS, '/base/subdir/file.js')}"/>
  • You can use relative paths in files in static resource archives to referto other content within the archive.For example, in your CSS file, named  styles.css, you have the following style:
          table { background-image: img/testimage.gif }

When you use that CSS in a Visualforce page, you need to make sure the CSS file can find the image. To do that, create an archive (such as a zip file) that includes styles.css and img/testimage.gif.  Make sure that the path structure is preserved in the archive. Then  upload the archive file as a static resource named “style_resources”.  Then, in your page, add the following component: 

<apex:stylesheet value="{!URLFOR($Resource.style_resources, 'styles.css')}"/>

Since the static resource contains both the stylesheet and the image, the relative path in the stylesheet resolves and the image is displayed.
  • Through a custom controller, you can dynamically refer to the contents of a static resource using the <apex:variable> tag. First, create the custom controller:
global class MyController {
    public String getImageName() { 
        return 'Picture.gif';//this is the name of the image 
    }
} 

Then, refer to the getImageName method in your <apex:variable> tag:

<apex:page renderAs="pdf" controller="MyController"> 
    <apex:variable var="imageVar" value="{!imageName}"/> 
    <apex:image url="{!URLFOR($Resource.myZipFile, imageVar)}"/> 
</apex:page>

If the name of the image changes in the zip file, you can just change the returned value in getImageName.



More about Visualforce Tags Examples:
http://sfdcsrini.blogspot.com/2014/06/visualforce-form-tags-with-examples.html







Saturday, January 24, 2015

Salesforce Governor Limits

Salesforce Governor Limits


Since Apex runs in a multitenant environment, the Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources. These limits, or governors, track and enforce the statistics outlined in the following table. If some Apex code ever exceeds a limit, the associated governor issues a run time exception that cannot be handled.


Description
Limit
Total number of SOQL queries issued
100
Total number of SOQL queries issued for Batch Apex and future methods
200
Total number of records retrieved by SOQL queries
50,000
Total number of records retrieved by Database.getQueryLocator
10,000
Total number of SOSL queries issued
20
Total number of records retrieved by a single SOSL query
200
Total number of DML statements issued
150
Total number of records processed as a result of DML statements,Approval.process, or database.emptyRecycleBin
10,000
Total number of executed code statements
200,000
Total number of executed code statements for Batch Apex and future methods
1,000,000
Total heap size
6 MB
Total heap size for Batch Apex and future methods
12 MB
Total stack depth for any Apex invocation that recursively fires triggers due toinsert, update, or delete statements
16
For loop list batch size
200
Total number of callouts (HTTP requests or Web services calls) in a request
10
Maximum timeout for all callouts (HTTP requests or Web services calls) in a request
120 seconds
Default timeout of callouts (HTTP requests or Web services calls) in a request
10 seconds
Total number of methods with the future annotation allowed per Apex invocation
10
Maximum size of callout request or response (HTTP request or Web services call)
3 MB
Total number of sendEmail methods allowed
10
Total number of describes allowed
100
Total number of classes that can be scheduled concurrently
25
Total number of test classes that can be queued per a 24–hour period
The greater of 500 or 10 multiplied by the number of test classes in the organization

Visualforce Limits

Available in: Contact Manager, Group, Professional, Enterprise,Performance, Unlimited, and Developer Editions


Limit

Value

Maximum response size for a Visualforce page

Less than 15 MB

Maximum view state size in a Visualforce page

135KB

Maximum size of a Visualforce email template

1 MB

Maximum file size for a file uploaded using a Visualforcepage

10 MB

Maximum size of HTML response before rendering, whenVisualforce page is rendered as PDF

Less than 15 MB

Maximum PDF file size for a Visualforce page rendered as a PDF

60 MB

Maximum total size of all images included in a Visualforcepage rendered as a PDF

30 MB

Maximum response size of a JavaScript remote call

15 MB

Default timeout for a JavaScript remoting call

30000milliseconds (30seconds)

Maximum timeout for a JavaScript remoting call

120000milliseconds (120seconds)

Maximum number of rows retrieved by queries for a singleVisualforce page request

50,000

Maximum number of rows retrieved by queries for a singleVisualforce page request in read-only mode

1 million

Maximum number of collection items that can be iterated in an iteration component such as <apex:pageBlockTable> and<apex:repeat>

1,000

Maximum number of collection items that can be iterated in an iteration component such as <apex:pageBlockTable> and<apex:repeat> in read-only mode

10,000

Maximum number of field sets that can be displayed on a single Visualforce page.

50

Maximum number of records that can be handled by StandardSetController

10,000



SOQL and SOSL Limits


Feature

Limit

Limit Description

SOQL statements

Maximum length of SOQL statements

By default, SOQL statements cannot exceed 20,000 characters in length.

SOSL statements

Maximum length of SOSL statements

The SOSL statement character limit is tied to the SOQL statement character limit defined for your organization. By default, SOQL and SOSL queries cannot exceed 20,000 characters.

SOSL search query strings

Maximum length ofSearchQuerystring

If the SearchQuery string is longer than 10,000 characters, no result rows are returned. If SearchQuery is longer than 4,000 characters, any logical operators are removed. For example, the ANDoperator in a statement with aSearchQuery that’s 4,001 characters will default to the OR operator, which could return more results than expected.

SOSL query results

Maximum number of rows returned

2,000 results total (API version 28.0 and later), unless you specify custom limits in the query. Previous API versions return 200 results.

Relationship queries

Relationship query limits

·         No more than 35 child-to-parent relationships can be specified in a query. A custom object allows up to 25 relationships, so you can reference all the child-to-parent relationships for a custom object in one query.
·         No more than 20 parent-to-child relationships can be specified in a query.
·         In each specified relationship, no more than five levels can be specified in a child-to-parent relationship. For example,Contact.Account.Owner.FirstName(three levels).
·         In each specified relationship, only one level of parent-to-child relationship can be specified in a query. For example, if the FROM clause specifies Account, the SELECT clause can specify only the Contact or other objects at that level. It could not specify a child object of Contact.

 

FOR VIEW and FOR REFERENCE

MaximumRecentlyViewedrecords allowed

The RecentlyViewed object is updated every time the logged-in user views or references a record. It is also updated when records are retrieved using the FOR VIEW or FOR REFERENCE clause in a SOQL query. To ensure that the most recent data is available, RecentlyViewed data is periodically truncated down to 200 records per object.

OFFSET clause

Maximum number of rows skipped by OFFSET

·he maximum offset is 2,000 rows. Requesting an offset greater than 2,000 will result in aNUMBER_OUTSIDE_VALID_RANGE error.

ORDER BY clause in SOQL statement

ORDER BY fields limit

32 fields


Metadata Limits



The following are limits for deploying and retrieving metadata. These limits apply to the Force.com IDE, the Force.com Migration Tool, and the Metadata API.

Metadata Limit
                Limit Description
Retrieving and deploying metadata
Metadata API can deploy and retrieve up to 5,000 filesor 400 MB at one time.
While a specific file size limit is not enforced, you might encounter out-of-memory errors for very large files.

Change sets
Inbound and outbound change sets can have up to5,000 files of metadata.



 
| ,