Skip to main content

Posts

Showing posts from 2013

Inline Editing is not available for a specific object

Inline editing is a handy bit of user friendliness,less time consuming and an efficient way of editing a value of a field from the detail page of a record OR from List View of records . Enabling inline editing is simple. We can enable from User Interface settings. Here an image where you can enable inline editing.  Go to the Set up-->Customize-->User Interface-- check  Enable Inline Editing check box. Now inline editing concept will not work for some object. Why is it not working for some object ? To  use inline editing concept then edit action of specific object should not overridden with any visual-force page. If the Edit action has been overridden for an object, Inline Editing will not be available for that object. To determine this: For standard objects : Go to Setup | Customize | <Object> | Buttons & Links, and note the "Overridden" checkbox next to the 'Edit' standard button. For custom objects: Go to Setup | Create | Objec...

How to get Picklist Value of an object Dynamically

This is very simple. I am sharing some code ,please go through this Here is My Controller  public class testclass {     public Job__c job{get;set;}     public List<SelectOption> options{get;set;}     public testclass(){         options = new List<SelectOption>();         Schema.DescribeFieldResult fieldResult = Job__c.Status__c.getDescribe();         List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();         for( Schema.PicklistEntry f : ple){                   options.add(new SelectOption(f.getLabel(), f.getValue()));         }     }         } My Page  <apex:page controller="testclass ">   <apex:form>       <apex:pageBlock>              ...

Sending Custom Object Information in a Mail

Sometimes we try to send some custom object information in mail. For sending mail Sales-force has  provided 4 types of email template. We can design the template as per our requirement. We can  use simple text template and use merge field to send custom object information. But that template  will work perfectly only If we use in the workflow.  If we send mail from apex code then that merge field value will not be displayed, except we can  display Lead ,Contact and User object information. For example  Dear {!Contact.Name} -- It will display Sub-- {!CustomObject.name}-- It will not display. This functionality is not yet activated by Sales-force, Here is an idea regarding same. https://success.salesforce.com/ideaView?id=08730000000BpYU Why not CustomObject information ? If we use the template in apex code (By using Messaging.SingleEmailmessage method) for sending mail then  setTargetObjectId(ID) method is require...

Salesforce Winter 14 – New Features

Apex statement   Governor   limit is removed Code coverage cloumn is removed in list of apex class OFFSET can be used in SubQuery  New Database methods added -  Database . getUpdated ,  Database.getDeleted  and  Database.merge . Preview button added in visual force page New componet  <apex:input>  added, type attribute is used in this   <apex:input> component. LoadOnReady=”true”  attribute is added in <apex:includeScript> component . Developer consol support java script css,xml and plain text. Static Resource can be created from  Developer consol. Till now Lookup field can only search Name field however now we have option to “search All” Fields. Report chart is added in detail page, maximum 2 chart  can be added. Business process like work flow can be written on User Object. Salesforce login page will be completely customizable. Service Cloud Console” is renamed to “Salesf...

How to use Date Time Variable in Dynamic Query

In some scenario you might have come across to fetch record with in some date time range.  Here I am sharing some code for this. Suppose I am querying records from Minutes Object. There is two field Start_Time and End_Time present  in Minutes Object. This is my page    <apex:inputField value="{!minute.Start_Time__c}" required="true" label="From Date"/>  <apex:inputField value="{!minuteObj.End_Time__c}" required="true" label="To Date"/> <apex:commandButton action="{!convertValidMinutesToUsage}" value="Process Minute's"/> This is my controller  public with sharing class ControllerValidMinutesToUsage {      public Minute__c minute{get;set;}      DateTime startDate;      DateTime endDate;      string query;      public ControllerValidMinutesToUsage(){             minute =  new Minute__c();     } ...

How to get key prefix of an Object in Salesforce.

We know there are two types of record-id are present in salesforce. 15 digit -- Case Sensitive 18 digit -- Case Insensitive Only 3 digit of ids represent object type . for example  Account-- 001 Contact-- 003 Opportunities --006 Lead  --- 00Q How will get these prefix dynamically, I mean by using apex code ? Schema.Describe SObjectResult r = CustomObject__c .sObjectTy pe.getDescribe( ); String keyPrefix = r.getKeyPrefix( ); System.debug('P rinting --'+keyPrefix ); It will print prefix of Custom Object id.

NOT IN Keyword in Soql in Salesforce.

Suppose there is a requirement to fetch all accounts record which don't have any contacts, how will we do it? We can fetch account with their corresponding contact record in a in line query. for example list<Account> listOfAccounts = [SELECT id, Name,                                                  (SELECT id,name FROM Contacts)                                                   FROM Accounts]; list<Account> accountListwithoutContact = new list<Account>(); for(Account act :listOfAccounts ){       if(act .Contacts !=null && act .Contacts.size() !=0){               accountListwithoutContact.add(act)   ;       } } accountL...

Fetching Unique Record in Salesforce

It seems to be very easy to fetch unique record . You must be thinking Distinct  keyword can be used for this. But saleforce does not support  Distinct key word . Another approach is we can us NOT IN key word for this. If we use this some error is there . list<Account> listofAccounts = [SELECT id, Name                            FROM  Account                            WHERE Name NOT IN (SELECT Name FROM Account)]; You will face some error;         COMPILE ERROR: Invalid bind expression type of SOBJECT:Account for column of type String Because Inner & outer Query should have different object Type. That means if outer query is in Account then inner query must be in Contact. Then the actual solution is we have to use GROUP BY key word. GROUP BY returns aggregate result list. lIST...

Adding Header Check Box in Pageblock Table

I have faced some requirement in my development work . User must be able to select all the record in the page block table in one click . So I added header check-box  in page block table .  Here is the code how I achieved this. Only Java Script code I have used . This is the my page <apex:page controller="ControllerforheaderCheckboxinPBT">     <script type="text/javascript">                  function checkAll(cb){             var inputElem = document.getElementsByTagName("input");             for(var i=0; i<inputElem.length; i++){                 if(inputElem[i].id.indexOf("checkedone")!=-1)                     inputElem[i].checked = cb.checked;             }         }  ...

Adding Custom Button Clone In Account

This is a very simple post. We all have seen clone button is present in Standard and Custom Object record except Account. User may expect clone button in Account object also. For them I have done little work around. When we will create custom button we will find three content source. URL OnCick JavaScript Visulforce page By using all there we can do clone functionality. But the best choice will be my favorite URL. Process Go to Customize,  Account ,Buttons, Links, and Actions  Click on New Button or Link Enter Label as Clone Choose Display Type as Detail Page Button Choose Behavior as Display in existing window without header and side bar. Content Source as URL Enter this URL--https://ap1.salesforce.com/{!Account.id}/e?clone=1&retURL=%2F{!Account.Id} Click on Save Now add Clone button in layout. Let's disccuss something about this URL  https://ap1.salesforce.com /{!Account.id}/e?clone=1&retURL=%2F{!Account.Id} Red color text represen...

Displaying Image in Pdf

I have come across a scenario image is not appearing in pdf  sometimes.For this I have shared some tricks. It is very easy to display an image in Visulaforce page. Process Crate a static resource and store that image Click in View file link  Copy the url Add apex:image tag in vf page.   <apex:image url = "https://ap1.salesforce.com/resource/logo"  width="180" height="60" /> Image will be displayed. When you render that page as pdf then sometimes image will not be appear. To appear image every time, I have done some work around and I would love to share it.  Lets talk about the image url --- "https://ap1.salesforce.com/resource/ 1380178695000 /logo". All must be familiar with each term except this 1380178695000. What is that value? This is nothing but the lastmodifiedtime of static resource. 1380178695000 must be dynamic. To get dynamic value I have used some function  SystemModStamp. Here is my page and Controll...

VisualForce Charting in Salesforce

As salesforce has given us the functionality of report and dashboard to create chart then what is the use of visualforce charting?. In some situations existing functionality of salesforce can not meet our requirement properly . Suppose there is a requirement to compose custom pages that combine charts and data tables in ways that are more useful to our organization.In that case visual force charting is useful.There are also other way to meet this requirement. We can use Google chart Api for this.In my previous post I have explained. Visualforce  charting gives you an easy way to create customized business charts, based on data sets you create directly from SOQL queries, or by building the data set in your own  Apex code. By combining and configuring individual data series, you can compose charts that display your data in ways meaningful to your organization. Visualforce  charts are rendered client-side using JavaScript. This allows charts to be animated and visual...

Exploring all chart in Visualforce page by using JavaScript Remoting & Google Charts API.

This post is all about how to draw a chart in Visual force page by using JavaScript Remoting & Google Charts API. I had faced some requirement to draw a different types of chart in a visualforce page and also to display number of  distinct record for further reference. I had done some work around and finally I had reached to the final destination. Here I have created one object  ChartObject__c and two field Name and Amount . Here I am sharing some code snippet for your reference.  <apex:page controller="GoogleChartsController" sidebar="false">     <!-- Google API inclusion -->     <apex:includeScript id="a" value="https://www.google.com/jsapi" />     <apex:sectionHeader title="Google Charts + Javascript Remoting" subtitle="Demoing - Opportunities by Exepected Revenue"/>           <!-- Google Charts will be drawn in this DIV -->     <div id="chartB...

Uses Of Apex Repeat

An iteration component that allows you to display the contents of a collection according to a structure that you specify. The collection can include up to 1,000 items. This component cannot be used as a direct child of the following components: <apex:dataTable> <apex:pageBlockTable> <apex:panelBar> <apex:selectCheckboxes> <apex:selectList> <apex:selectRadio> <apex:tabPanel> Suposse there is a requirement, you need to display Five accounts with thier Contacts in a visualforce page.Format should be like this image How will you do it? It is very simple, just use repeat in visualforce page. Here is visualforce page and controller <apex:page controller="UseofRepeatOnAccountController" sidebar="false" tabStyle="Account">     <apex:form >     <apex:pageBlock title="Accounts with assoicated Contacts">         <apex:repeat value="{!accountList }" var="acc">        ...

Generating pdf Using Conga Composer

Conga Composer lets you to create documents from a button or link placed on a Salesforce.com page layout. It merges Salesforce.com data with Word, Excel, PowerPoint, email, or PDF templates to create finished documents. Benefit Of Conga Composer Easily create and deliver customized documents,  Presentations and reports using Word, PowerPoint, Excel, HTML email and PDF forms from standard & custom objects.  Generate quotes, proposals, account plans, invoices, contracts, letters & more. In order to use  Conga Composer , we need to install two things.     Conga Composer      Conga Query Manager. If we need to use some related object's record then Conga Query Manager is necessary otherwise Conga Composer is enough. How to Install Conga Composer Go through this link for installation . http://knowledge.appextremes.com/appextremes/ext/kb110-how-to-install-conga-composer How to Install Conga Query Manager Go through t...