Posts

Showing posts from 2014
Image
Truncating Custom Objects Truncating custom Object allows you to remove all of the object's records, while keeping the object and its metadata. When you truncate a custom Object Salesforce places a truncated object in the Deleted Object list for 15 days.  It appears in deleted object list as objectname_trunc. NOTE : During this time, the truncated object and its record continue to count against your org limits. NOTE : Truncated Objects can not be restored to their original state. Truncating object is a fast way to permanently remove all of the records from an object, while keeping object and it metadata intact for future use. Lets play with truncation I have created a custom object "TestObject" and inserted few records. On object defination page I can not see "Truncate " button  to enable Truncate go to Setup -> Customize -> User Interface and select " Enable Custom Object Truncate " on saving it a new but...
Image
New Button in Look-up Window When you create a new Look-Up or Master-Detail field on any custom object or on any standard object and then during look-up you see a New button clicking on it will allow you to create a new record on run from look-up window. Before discussing more about it few important points to note : 1. This button is available only for Account and Contact. New Button for Account Look-up New Button for Contact Look-up No New Button for Opportunity, same for other custom and standard objects New Button for Master-Detail relationship with Account, same for Contact 2. Record created by clicking New button on look-up window will bypass validation rules. If you want to remove this "New" button from lookup window then you can do it from Setup -> Customize -> User Interface and deselect "Show Quick Create " and save the settings. after deselecting check the lookup window to confirm if New...
Image
Make Rich Text Field Mandatory Using Validation Rule If you want to make field of data type Rich Text mandatory, what would you do? One way to achieve this is by making field mandatory from page layout, that will work fine if you are creating records from salesforce UI but that won't work when you will upload data using Data-loader. What will be the next approach, writing validation rule ?  In validation rule you going to use ISNULL or ISBLANK ? Lets try with ISNULL and ISBLANK one by one 1. ISNULL : Determine if expression is null (blank) and return TRUE if it is. If it contains value, this function returns FALSE. create a validation rule and check ISNULL() for that rich text field like below snapshot. in validation rule I have checked ISNULL(Rich_Text__c) and saved it.  Now try to save the record without entering any value in Rich_Text__c field, validation rule won't work. Why ISNULL didn't work? According to Salesforce Text Fields are n...
Difference between SOQL and SOSL SOQL stands for Salesforce Object Query Language SOSL stands for Salesforce Object Search Language SOQL can be used in apex triggers, apex classes SOSL can not be used in apex triggers. SOQL returns Integer or list of sObject SOSL returns List of List of sObject SOQL can be used for DML operations SOSL can not be used for DML operations Total no. of SOQL queries issued : 100 Total no. of SOSL queries issued : 20 Total no. of records retrieved by SOQL query : 50,000 Total no. of records retrieved by SOSL query : 2,000 Use SOQL when 1. you know in which objects or fields the data resides. 2. you want to retrieve data from single object or multiple objects that are related to one another. 3. you want to count number of records meeting the criteria in query. 4. you want to sort the result. you want to retrieve data from number, date or checkbox fields. Use SOSL when 1. you don't know in which object or ...
Image
Rollup Summary for Lookup Field Few days back requirement came across where there was a need to create a rollup summary field for objects which do not have Master-Detail relationship but lookup relationship, and we all know rollup summary field is only available for Master Detail so we left with no other option but to write Apex Code. We have two objects LookupMaster__c and LookupChild__c having lookup relation.    We will write trigger on LookupChild__c for event after insert, after update, after delete. trigger customRollup on LookupChild__c(after delete, after insert, after update){          set<Id> masterIdSet = new set<Id>();          if(trigger.isInsert) {         for(LookupChild__c lookupRec : trigger.new) {             masterIdSet.add(lookupRec.LookupMaster__c);         }       ...
Types of Sandbox 1. Developer Sandbox : Developer sandbox are intended for coding and testing. Developer sandbox copies all application and configuration set up information to sandbox. 2. Pro - Developer Sandbox : Pro Developer are intended for coding and testing. Copies all your production org reports and dashboards, price book, products, apps and customization but excludes all organisation standard and custom records, documents and attachments. Pro developer have large storage limit which allow more robust development and more test data sets 3. Partial Data Sandbox : Partial copy sandbox are intended to be used as testing environment and can be used for quality assurance tasks such as user acceptance testing and training. It includes reports and dashboards, pricebook, products, app, customization and custom and standard records, documents and attachments. 4. Full Sandbox : Exact copy of Production including all data, supports full performance testing, load testing. ...
Page Layout and Record Types  Page Layout: Page Layout is a organisation of fields, custom links, and related lists on Object detail page, From page layout we can see which fields links and related list a user will see and also decide which field should be read only and required. Page layout also provides us to create new page sections. Record Types: Record Type allow us to associate different business processes and subset of pick-list value to different users based on their user profile. Record type can be used to decide what page layout user will see while viewing the records based on their user profile. We can tailors our user interaction according to business specific needs.
Salesforce Activities : Difference between Task and Event Activities in Salesforce are of two types Task and Event. Task are basically used to log an activity like call, reminders, emails while Events are used scheduling meetings etc. 1. Tasks : A task is an activity not schedule for any date and time. You can specify a due date for a task or there may not be any particular date or time that task need to be completed examples:   - making a phone call  - opening a email think of task like a check box whose value can only either be true or false. 2. Event : An event is an calendar event scheduled for a specific day and time examples :  - meeting,   - conference call event carry a aspect of duration of time
Image
Salesforce Relationships In salesforce you can  associates objects with other objects using relationship. You can define different types of relationships by define custom relationship fields and different relationship also determine the approach of data deletion, record ownership, security. Types of Relationship: 1. Master - Detail (1:n) : Its a parent child relationship in which Master object controls the behavior of child object like a) When master record is deleted its related detail/child record also gets deleted. b) Owner field on detail/child object is not available and its owner is automatically set to owner of its Master object record. c) Custom object of detail side of Master Detail relationship do not have sharing rule, manual sharing as these require Owner field. d) Detail record inherit the sharing and security settings from its master record. e) Master - Detail relationship field is required on page layout of the detail record. ...
Custom Component Custom Components allows the custom visualforce functionality to be encapsulated as discrete modules, which actually provides two advantage: 1. Code re-use : custom component provides an functionality of code reuse, we can use the same code for number of pages. 2. Functional decomposition : if visualforce page is lengthy then we can broke down the page into custom components to make it easier to develop and easy to maintain. like visualforce page custom component can also have controller but only custom component. * Custom component do not have any associated security settings. A user with access to visualforce page have access to all custom component used in visualforce page. example : go to setup > develop >  custom componet  to create custom component and paste the below code. <apex:component >   <apex:attribute name="Contact" type="Contact" description="The contact to edit" require...
Change Images When Picklist value Changes You can add create a functionality in which on change on picklist value the images will change. To do so add images in your static resource and create vf page and controller with below code.  Visualforce page: <apex:page controller="PicWithPicklist">     <apex:form >         <apex:pageBlock >             <apex:selectList value="{!legend}" size="1">                 <apex:selectOptions value="{!legendNames}"></apex:selectOptions>                  <apex:actionSupport event="onchange" reRender="picPanel"/>             </apex:selectList>       ...
Image
Winter 15 Release  - Advanced Setup Search Winter 15 makes the search more powerful allowing to search for individual setup items which in earlier version only returned the titles of pages in setup menu.  In earlier version when we tried to search workflow the result returned is like below picture.   but from winter 15 when tried to search workflow result returned would be     This feature is enabled for all organization by default. You can disable this feature from setup -> user interface
Image
Difference between renderAs, rendered and reRender 1. RenderAs : it is used with page component with name of any supported content converter. Currently only PDF is the only supported content converter. example: below code will give output in pdf form <apex:page standardController="Account" renderAs="pdf">     <apex:pageBlock title="welcome {!$User.FirstName}, ">         <apex:pageBlockSection columns="1" title="here is your Account Detail :">             <apex:outputField value="{!account.Name}"/>             <apex:outputField value="{!account.AccountNumber}"/>         </apex:pageBlockSection>     </apex:pageBlock> </apex:page> 2. Rendered : it use to show or hide visualforce elements. It is bound Boolean value in controller which can...
Image
What is My Salesforce Edition Have you ever came across a situation where you need to know what is your Salesforce Org edition. If yes what you have done ?  There are few easy ways to find out Salesforce edition. 1. From your web browser's Salesforce tab Hover mouse over your salesforce tab in your web browser               in above snapshot text appears as "salesforce.com - Developer Edition "   when lands on Account tab text changes to "Accounts: Home ~ salesforce.com - Developer Edition " but the edition name always mentioned at last "Developer Edition", It will work for other edition as well.     2. Second way to find out the edition is by clicking  SETUP > ADMINISTER   Hope this will help