Posts

Showing posts from 2016

Add Comma in Number Value in Visual force Page

<apex:outputText value="{0, number, ###,##0.00}">      <apex:param value="{!item.numberValue}"/>  </apex:outputText> Note: Comma depend on ### Output  : 589,700.00

Required to Fill Comment Before Approved/Rejected Using Apex Code

Requirement:  When User Approved or Rejected the approval then it is required to fill Approval  or Rejected reason Solution : You need to write the the trigger on Before Update as mention below     private void ApprovedOrRejectedComment(list<Sobject> triggerNew, map<id,Sobject> triggerOldMap) {  Map<Id, Sobject> MapIDToObject  = new Map<Id, Sobject>{};      for(Sobject objSobj: triggerNew) {     Sobject oldobjSobj = triggerOldMap.get(objSobj.Id); if (((oldobjSobj.Status != 'Approved'  && objSobj.Status == 'Approved' ) ||(oldobjSobj.Status != 'Rejected'  && objSobj.Status == 'Rejected')))              {  MapIDToObject.put(objSobj.Id, objSobj);   } }         if (!MapIDToObject.isEmpty())    { List<Id> processInstanceIds = new List<Id>(); for (Sobject objSobjs : [SELECT (SELECT ID FROM                                          

Get Longitude and Latitude from the Google Api

Image
Requirement: To get longitude and latitude of address using google api in salesforce. When Account is insert/update if account has shipping address then auto fill latitude and longitude values Soloution >> You need to hit google api call. it is free you can call it easily Note>>1)  Add end point URL in Remote site setting SetUp>> remoteSiteSetting>> AddURL:   https://maps.googleapis.com 2) Add two fields as a text type on Account object one is longitude  and othe is latitude  Longitude >> Longitude__c Latitude >> Latitude__c Step 1>> Need to Write trigger on Account Object You need to write two class and one trigger Class 1 /* This class is using for quering Billing address and call Google Map api and find the lattitue and long from API */ public  class AccountGetBillingAdress {   // toCheckFutueCall varibale is a boolean variable if it has alreday exist     private static Boolean toCheckFutueCall = false;

Open Service Console tab and Salesforce Classic using JavaScript on Custom Button in Salesforce

Requirement: Need to create a custom button on detail page, when click on it open in new tab in service console apps and salesforce classic Solutions: if (typeof(srcSelf) == 'function') {  // This is for Console app srcSelf('URL&isdtp=vw');  }  else {  // This is for salesforce classic window.open('URL');  } Notes: isdtp=vw : this is hide sidebar in consolse app URL  = '/500/e?CF00NN0000001i1d6={!MergeFieldAPINAME}&CF00NN0000001i1d6_lkid={!MergeFieldAPINAME}&ent=Case' In case of any issue please feel free call to me Thanks, Sumit Shukla skypeID : shuklasumit1 sumitshukla.mca@gmail.com Mob: 9711055997

Case Assignment Using Apex Code

Requirement: When Case will insert using apex code assignment check box should be true. Solution: List<Case> lstofCase = new List<Case>(); Case objCase = new Case();   ObjCase.status="New"; lstofCase.add(ObjCase); Insert lstofCase;  Database.DMLOptions dmo = new Database.DMLOptions();   dmo.assignmentRuleHeader.useDefaultRule = true;    system.debug(' dmo.assignmentRuleHeader.useDefaultRule***'+ dmo.assignmentRuleHeader.useDefaultRule);  Database.update(lstofCase, dmo);   Thanks, Sumit Shukla mob: 9711055997 skypeID: shuklasumit1 email ID: sumitshukla.mca@gmail.com

Pagination using SetController in Visual force Page and Maintain CheckBox Values

Image
Requirement: Show the record on visual force page in table , user can select some record and click next and previous button and select more record and save the selected data Solution: Step 1: Create a Class / / This is class have logic to show the record per page and store the session after //click on next and previous button global class  CustomIterable implements Iterator<list<ContactWrapper>> {     list<ContactWrapper> InnerList{get; set;}    list<ContactWrapper> ListRequested{get; set;}    Integer i {get; set;}     public Integer setPageSize {get; set;}     public CustomIterable(List<ContactWrapper> lstAccWr)    {        InnerList = new list<ContactWrapper >();         ListRequested = new list<ContactWrapper >();             InnerList = lstAccWr;        setPageSize = 10;        i = 0;     }       global boolean hasNext(){         if(i >= InnerList.size()) {            return false;         } else {        

Select and Deselect Check Box on Page Block Table in Visual force Using JavaScript

Image
Requirement: Using javascript select all and Deselect all checkbox in pageBlock Table Solution <apex:page sidebar="false" Controller="ManageOppController">     <script>         function selectAllCheckboxes(obj,receivedInputID){             var inputCheckBox = document.getElementsByTagName("input");                               for(var i=0; i<inputCheckBox.length; i++){                           if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){                                                          inputCheckBox[i].checked = obj.checked;                 }             }         }     </script>         <apex:form >         <apex:pageBlock >         <apex:pageBlockSection >                     <apex:pageBlockTable value="{!lstofwrapperClas}" var="ObjWrap">                                     <apex:column headerValue="Select">