Prerequisites: You will need to download the jQuery and jQuery UI libraries. jQuery is the core library which offers DOM manipulation methods and jQuery UI is a higher level library which constructs widgets for use on your page. From the jQuery UI site, you can download a zip tailored to the portions of the libraries you need.Once you have the ZIP in hand, you’ll need to upload it as a static...
Relationship in Salesforce
When two objects are related in the database, they are linked together by a relationship field. This allows you to associate related information easily between objects. All relationships maintain some form of a parent-child relationship. This can be thought of as a hierarchical structure where one object looks up to the other, and as such, you only need to create one relationship field. You...
How to create dynamic drop downs in Salesforce?
I had task of creating two drop downs for a custom object in Salesforce: 1. Country – Listing all countries of the world. 2. State – Listing all States for selected Country dynamically. This wasnt a visualforce page, had to do it through custom fields itself. So I came across Dependent Fields concept in Salesforce. Its pretty easy to use and I just loved the way Salesforce has made it...
Using URLFOR function in Apex Salesforce
While developing your Visualforce pages you may need to be able to obtain the URL of certain actions or your static resources. I found it personally a challenge since the documentation for “URLFOR” function is not included in “Visualforce Developer Guide” itself and instead included in the general help area of Salesforce. Generally you can use the “URLFOR”...
How to open a page in new window in salesforce apex
public PageReference CancelTicket()
{
pageReference ref = new PageReference(‘/apex/PageName’);
ref.setRedirect(true);
return ref;
}
Where PageName= name of the page which you want to create and open
Using component in Visualforce
Some Visualforce components, such as <apex:pageBlockTable> or <apex:dataTable>, allow you to display information from multiple records at a time by iterating over a collection of records. To illustrate this concept, the following page uses the <apex:pageBlockTable> component to list the available job positions: Visual Force Code: <apex:pageblocktable value=”{...
SOLVED: “This record type cannot be deactivated because the following profiles use this record type as default.”
I just thought I’ll play with a Record Type for Opportunity and delete it later but got an headache finding how to solve this error. Finally, here is the way: Goto Setup -> Administration Setup -> Manage Users -> Profile Go inside your corresponding profile and search for that particula Record Type name, in my case it was “Partner Opportunity Record Type”. Edit this and...
Creating Dependent SelectLists in VisualForce
We can create the SelectLists in VisualForce whose values will depend on the value selected in another selectlist.The method i have used here is using the Lists collection by programatically filling the values of the dependant selectlist based on the selected value. VisualForce code: <apex:outputLabel value=”Select State”‘> <apex:selectList value=”{...
Uploading a document in apex salesforce using custom controller
sometimes you may want to create a process where uploading a document is mandatory. You can create a single Visualforce page with all of the fields for the record plus the field required to upload a document. code below is an example //VISUALFORCE PAGE <apex:page controller=”docex”> <apex:outputLabel value=”Document Name”/> <apex:inputText...
How to export leads to excel sheet in salesforce apex
Here is the code for exporting leads to excel in salesforce apex Class Code: public class exportExcel { public string header{get;set;} public List<wrapper> lstwrapper {get; set;} public class wrapper{ public string Id{get; set;} public string Name{get; set;} public string Email{get; set;} } public string Filetype{get;set;} public boolean isExcel {get;set;} public boolean isCsv {get;set;}...