Posts

Showing posts from May, 2015

Some Very useful Salesforce Links

http://sfdchack.blogspot.in/ http://blog.jeffdouglas.com/

Create Custom Lookup in salesforce

Image
Requirement : Create a custom Lookup Solution : you need to create two visual force page Create first VF Page and Class Page Code <apex:page controller="LookupMainControllerForFilter" tabstyle="Account"> <script>     var newWin=null;     function openLookupPopup(name, id)     {         var url="/apex/LookupExamplePopup?namefield=" + name + "&idfield=" + id;         newWin=window.open(url, 'Popup','height=500,width=600,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');         if (window.focus)          {             newWin.focus();         }                      return false;     }                        function closeLookupPopup()     {        if (null!=newWin)        {           newWin.close();        }       } </script>                      <apex:form >     <apex:pageBlock title="Lookup">       <apex:pageBlockSection columns=&qu

Wild Card Searching SOQL in Salesforce

Image
Requirement : Data Filter Based on any Character  Page Code <apex:page controller="wildcardController">   <apex:form >     <apex:pageblock >                  <apex:inputtext value="{!inputtext}"/>         <apex:commandbutton value="Search" action="{!searchRecords}" reRender="ss,msgid"/>     </apex:pageblock>     <apex:pageblock id="pbId">       <apex:pageblocktable value="{!accList}" var="acc" id="ss">         <apex:column value="{!acc.name}"/>         <apex:column value="{!acc.accountnumber}"/>       </apex:pageblocktable>     </apex:pageblock>     <apex:outputLabel value="{!str}" id="msgid"></apex:outputLabel>   </apex:form> </apex:page> Class Code Public class wildcardController {     Public string inputtext{get;set;}     Public List

Filter Contact Based on Account

Image
Requirement : Created a VF Page . Show All Accounts on Drop Down List, When Select Account then related contacts with that Account should be visible in table. Solution :   Create a VF page and Controller Class as mention below Page Code <apex:page controller="ControllerforAccount">  <apex:form >      <apex:pageBlock >          <apex:pageBlockSection columns="1" title="Account">                              <apex:selectList value="{!selectedAccountId}" size="1">              <apex:selectOptions value="{!lstSelectOption}"></apex:selectOptions>           <apex:actionSupport event="onchange" action="{!AllContact}" reRender="contactlistId,outputID"/>       </apex:selectList>               <apex:outputLabel value="{!strMessage }" id="outputID"></apex:outputLabel>                                   

Make Salesforce calendar year drop-down to show earlier years

Image
Requirement: The birthdate field on the Contact object doesn’t show previous year and neither does it allow to switch back and forth the Years part easily. Solution: Below example will show the last 100 years. Go to Setup -> App Setup -> Customize -> User Interface. Here make sure the ‘Show Custom Sidebar Components on All Pages’ is checked. Go to Setup -> App Setup -> Home Page Layouts. Make sure all your Home Page Layouts have the Messages & Alerts component checked. Go to Setup -> App Setup -> Home Page Components. Here, click edit for Messages & Alerts. In the textarea, copy and paste the javascript code below and save (it can just go below your normal Messages & Alerts, won’t show up on the actual page). <script src="/js/dojo/0.4.1/dojo.js"></script> <script src="/soap/ajax/11.1/connection.js" type="text/javascript"></script> <script type="text/javascript"> dojo.requ

Call Rest Api and Json Parsing in Salesforce

Image
Requirement : To Call Current weather api show data on VF page, Based on Search City Solution:  Call the rest api and parse the json and one more thing add End Point url in Remote Site Setting First Step : Create a Class and Parse the JSON data Create Class: CurrentDayWeatherApiController  Class Code: public class CurrentDayWeatherApiController {            public string cityName{get;set;}        //   public boolean showpanel{get;set;}                    public List<weatherRecords> WeathersList{get; set;}     public CurrentDayWeatherApiController()     {     }     public void ShowWeather()         {                        try           {            if(cityName!=null && cityName!='')            {                 string endPointURL  = 'http://api.openweathermap.org/data/2.5/find?q='+cityName;                 Httprequest req = new Httprequest();                 req.setEndpoint(endPointURL);                 req.setMet