Posts

Get List of Year and Bind on Visual force Page using Apex Code

 public List<selectOption> lstSelectYear{get; set;}  public string strSelectyear{get; set;}  for(integer count = 2014; count <= currentYear ; count++)         {             lstSelectYear.Add(new SelectOption(string.valueof(count),string.valueof(count)));             //lstSelectYear.Add(new SelectOption('2015','2015'));         }     Page  <apex:pageBlockSection title="Year" rendered="{!boolIsShowCase}">            <apex:selectList size="1" value="{!strSelectyear}" id="test">                       <apex:selectOptions value="{!lstSelectYear}"></apex:selectOptions>                       <!-- <apex:actionSupport action="{!ShowButton}" event="onchange" reRender="idMain" /...

Insert Pdf and and Attachemt

There is Detail Page Button On Contract Object when Click on this button then it call another visual force based on Type Field Value and Genrate pdf after that again a pdf is created and after that first pdf is attached under second pdf and redirect to second pdf object ID Class Name public class clsGenerateAndSavePdf {          public boolean err{get;set;}     public boolean isTest = false;     public echosign_dev1__SIGN_Agreement__c agmt ;       public clsGenerateAndSavePdf(){                  err = false;        agmt = new echosign_dev1__SIGN_Agreement__c();     }          public pageReference gen...

Show and Hide Text Box Based on Selected Picklist Value using Jquery

<html>   <head>      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>      <script type="text/javascript">      $(document).ready(function() {      $('#types').change(function(){      if($('#types').val() === 'Other')         {         $('#other').show();          }      else        {         $('#other').hide();            }      });      });      </script>      </head>         <body>           <select id="types" name="types" >       <option value="Type 1">Type 1</op...

On CheckBox: Value Populate from On Text box to Other Using Jquery

 <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>  function switchpartnumber(switchpartnoid)         {             try {                 alert(switchpartnoid);                 if(document.getElementById(switchpartnoid).checked == true){                     var switchpartno = $(".InputtestClass").val();                     $(".outputtestClass").val(switchpartno);                        }             } catch (e) { alert('Internal Error!'+e) }                      } </script>  <apex:inputField type="CheckBox"onchange="switchpartnumber(this.id);"> ...

Manage Order of Trigger Execution in Salesforce for Object

Hi guys, Note: Handle the trigger order of execution: If any Case when you required to write 4 triggers on different - different events but on same object then don't write 4 trigger for same. Suppose you have 4 trigger on Account Object. 1- AccTrigger1.trigger 2- AccTrigger2.trigger 3- AccTrigger3.trigger 4- AccTrigger4.trigger Solution is mention as below STEP 1- Create only one trigger for one object(Account) like- In above case instead of having 5 triggers on  STEP 2- Create only 1 trigger that is AccountTrigger.trigger on Account Object. // Create Trigger as Mention Below trigger AccountTrigger on Account (after insert, after update, before delete, before insert, before update)  {     AccortunityTriggerHandler triggerHandler = new AccortunityTriggerHandler(Trigger.isExecuting,Trigger.size);         if(Trigger.isBefore && Trigger.isInsert){         triggerHandler.OnBeforeInsert(trigger....

How to Increment Sr No on Visual force Page

<apex:page>     <apex:form >             <table style="width:auto;margin-top:10px;" border="1" cellspacing="0" cellpadding="0" >                 <tr>                     <td  style="background-color:lightblue;font-weight:bold;vertical-align:bottom;text-align:center;width:34px;"> Sr.No </td> <td  style="background-color:lightblue;font-weight:bold;vertical-align:bottom;text-align:center;width:34px;"> Name</td>                 </tr>             </table>                 <apex:variable value="{!0}" var="Count"/>                              <table id="tblInfo" style="width:auto;border-top...

Batch Class and Dynamic Create Email Template

global  class batchClasAndSendDynamicEmailTemplate implements Database.Batchable<Sobject> {     set<Id> suid= new set<Id>();     set<id> sweekplanid = new set<id>();     map<id,user> mapManager = new map<id,user>();     Map<ID,List<Weekly_Plan__c>> mapUserIdToAWPList = new Map<Id,List<Weekly_Plan__c>>();     Map<ID,String> mapUserIdToManagerEmail = new Map<Id,String>();      Map<ID,String> mapManagerIdTomanager = new Map<Id,String>();      list<string> lstEmail = new list<string>();     string tempBody = '';     List<Weekly_Plan__c> listPJPWeeklyUpdate = new List<Weekly_Plan__c>();          global Database.Querylocator start(Database.Batchablecontext BC)     {         return Database.getQueryLocator([Sel...