• aaryan sri
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 4
    Replies
Hi All,
Disposition creation on lead record we are creating a task record for that. I wrote a logic on task trigger to capture lead status while task record creating. On task records creation we are capturing lead memberid, date and status from associated lead. Issue is task record lead status field is not matching with current lead status. Lead status is updating after task record creates task record, so task record lead status is not matching with current lead status. Please help me out how to match task lead status with current lead status.
below is the code logic written on Task tirgger handler 

 Map<id,Lead> mapLead = new Map<id,Lead>([SELECT ID,Name,CompName_HF__c, Membbno_HF__c,Recertdate_HF__c,Status FROM Lead Where id IN:lstLeadId]);
          for(Task objTask : lstNewTaskMap)
          {
              if(objTask.Task_Created_Profile_Name__c.contains('ORS'))
                {
                    System.debug(' Entered into Lead loop' );
                    if(objTask.Subject <> NULL && objTask.Subject.contains('Call') && objTask.Status=='Completed')
                    { 
                     System.debug(' Entered into Task Type loop' );
                      objTask.TaskSubtype=Static_Variables_Retention_HF.Task_SubType;
              
                }
                      if(objTask.whoid==null) continue;
                if(mapLead.get(objTask.whoid)==null) continue;
                if(objTask.WhoId <> NULL && objTask.WhoId.getSobjectType() == Lead.getSObjectType())
                  {
                  Lead objLead = mapLead.get(objTask.whoid);
                      system.debug('***** objLead '+ objLead);
            
                        if(objTask.Type != null && objTask.Type.contains('Call'))
                        { 
                               objTask.TaskSubtype=Static_Variables_Retention_HF.Task_SubType;
                
                        }
                            objTask.RecordTypeId=Static_Variables_Retention_HF.taskRetentionRTID;
                              system.debug('objLead.Membbno' + objLead.Membbno_HF__c);
                            objTask.Lead_MemberId_HF__c=objLead.Membbno_HF__c;
                              system.debug('objTask.LeadMemberId' + objTask.Lead_MemberId_HF__c);
                                objTask.Lead_Status_HF__c=objLead.Status;
                              system.debug('objTask.LeadStatus' + objTask.Lead_Status_HF__c);


 
HI,

  Am trying to restrict phone no to 10 digits and i should accept format either (999) 999-9999 or 999-999-9999 or 999999999.
I wrote below validation 
AND(
    NOT(ISBLANK(Prescriber_Phone_Number_Last_Fill_Date__c)),
    NOT(
        OR(
            ISNUMBER(Prescriber_Phone_Number_Last_Fill_Date__c ),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c,"[0-9]{3}-[0-9]{3}-[0-9]{4}"),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c, "\\D*?(\\d\\D*?){10}"),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c, "[0-9]{10}")
        )
    )
)    

It is allowing more than 10 and Alphabets .

 Can somebody help me how to fix this?
 
Hi,

I am inputting  taxid on UI in this format "00-0000000" and backend html code also enforcing same format. But some scenarios taxid on account object saving without hyphen like this"000000000". I am not able to replicate this scenario. Please help me, in which scenarios chances of taxid saving without hyphen. Below is the VF code for taxid.

<div class="col-md-6">
                                                            <div class="form-group">
                                                                <label>Tax ID Number</label><br/>
                                                                <apex:inputText id="SGFederalTaxId" value="{!objEnrollmentWrapper.objSmallGroup.objCompany.objAccount.TIN_HF__c}"
                                                                                styleclass="form-control maskField" html-validation-activated="true" html-validate-required="true"
                                                                                html-masking-pattern="00-0000000" html-placeholder="00-0000000"
                                                                                html-validate-minimum-length="10" html-validate-maximum-length="10"
                                                                                html-validate-required-alert-type="4" html-validate-on-change="true" html-enrollment-id="{!objEnrollmentWrapper.objEnrollmentRecord.Id}"
                                                                                html-validate-required-error-message="Required Field" html-validation-inline-message="true"
                                                                                disabled="{!objEnrollmentWrapper.boolEnrollmentReadOnly}"
                                                                                html-validation-focus-on-fail="true"
                                                                                html-validation-focus-on-fail-top-offset="-10"/>
                                                            </div>
                                                        </div>
 
Hi All,
Some body can help need to show column
1.out put text value red color if text value is closed 
2. out put text value green color if text value is open 
3. out put text value  grey color if text value is Existing

Below is the vf code
<apex:column >
<apex:facet name="header">PANEL STATUS</apex:facet>                                                
<p>  <span class="label label-default">{!objRecord.panel_status}</span></p>
 </apex:column>

 
Hi ,

   I am created a custome report in salesforce that csv or excel file should dropped Report folder on desktop  location. How to achive this? 
Hi All,

Based on condition, value should store on sring. Present formula writtens below way

totalBusinessDistance = String.valueOf((Decimal)ar.get('totalBusinessDistance')-(2*(Decimal)ar.get('totalCommutingMiles')));
  
 Presently  totalBusinessDistnece storing value of totalBusinessDistance- 2*totalCommutingMiles.  Now want to be if (totalBusinessDistance- 2*totalCommutingMiles) value comes below 0 then totalBusinessDistance store only 0 other wise it  should store (totalBusinessDistance- 2*totalCommutingMiles).

  
Hi All,

  Below code am not able to get 100% coverage . Please help me out

public class VFC02_ExportToCSV{
    
    private ApexPages.StandardController controller {get; set;}
    public List<TripDetails> trpDetail {get; set;}
    public List<List<TripDetails>> trpDetailForExport {get; set;}
    public String reqBody {get; set;}
    public String message {get; set;}
    public boolean error {get; set;}
    public boolean sucess {get; set;}
    public String tripId {get; set;}
    public String country {get; set;}
   
public VFC02_ExportToCSV() { }
    public VFC02_ExportToCSV(ApexPages.StandardController controller) {
        this.controller = controller;    
    }
    public List<TripDetails> getZero(){
        if(trpDetailForExport.size() >= 1){
            system.debug('In Get Zero  '+trpDetailForExport[0].size());
            return trpDetailForExport[0];
        }else{
            return null;
        }
    }
    public List<TripDetails> getOne(){
        if(trpDetailForExport.size() >= 2){
            return trpDetailForExport[1];
        }else{
            return null;
        }
    }
    public List<TripDetails> getTwo(){
        if(trpDetailForExport.size() >= 3){
            return trpDetailForExport[2];
        }else{
            return null;
        }
    }
    public List<TripDetails> getThree(){
        if(trpDetailForExport.size() >= 4){
            return trpDetailForExport[3];
        }else{
            return null;
        }
    }
    public List<TripDetails> getFour(){
        if(trpDetailForExport.size() >= 5){
            return trpDetailForExport[4];
        }else{
            return null;
        }
    }
    public List<TripDetails> getFive(){
        if(trpDetailForExport.size() >= 6){
            return trpDetailForExport[5];
        }else{
            return null;
        }
    }
    public List<TripDetails> getSix(){
        if(trpDetailForExport.size() >= 7){
            return trpDetailForExport[6];
        }else{
            return null;
        }
    }
    public List<TripDetails> getSeven(){
        if(trpDetailForExport.size() >= 8){
            return trpDetailForExport[7];
        }else{
            return null;
        }
    }
    public List<TripDetails> getEight(){
        if(trpDetailForExport.size() >= 9){
            return trpDetailForExport[8];
        }else{
            return null;
        }
    }
    public List<TripDetails> getNine(){
        if(trpDetailForExport.size() >= 10){
            return trpDetailForExport[9];
        }else{
            return null;
        }
    }
    public PageReference exportToCSVnew(){
        trpDetailForExport = new List<List<TripDetails>>();
        tripId = System.currentPageReference().getParameters().get('id');
        country = System.currentPageReference().getParameters().get('cty');
        Trip_Summary__c trp = new Trip_Summary__c();
        if(tripId !=null){
            try{
                trp = [select Id,First_Name__c,Last_Name__c,User_Id__c,Submitted_Date__c from Trip_Summary__c where Trip_Id__c =:tripId limit 1 ];
                
            }
            catch(System.Exception e) {
                  error = true;
                  message = e.getMessage();
            }
        }
          if(tripId != null){        
            trpDetail = new List<TripDetails>();
            HttpRequest req = new HttpRequest(); 
            req.setMethod('GET');
            
            //Set HTTPRequest header properties
            req.setHeader('content-type', 'application/json');
            req.setHeader('Content-Length','0');
            req.setHeader('Host',System.Label.SMT_Host);
            req.setHeader('Connection','keep-alive');
            req.setHeader('User-Agent','Fiddler');
            String endPointURL = System.Label.SMT_APIGEE_EndPoint;
            String AuthToken = System.Label.SMT_Base64;
            String authorizationHeader = 'Basic '+AuthToken;
            req.setHeader('Authorization', authorizationHeader);
            String EndPoint = endPointURL+tripId;
            req.setEndpoint(EndPoint);
            Http http = new Http();
            try {
                  //Execute web service call here 
                  HTTPResponse res = http.send(req); 
                  reqBody = res.getBody();
                  String temp = reqBody.replace('datetime','dttime');
                  reqBody = temp.replace('lng','longitude');
                  JSONTrip wrapJSONTrip = new JSONTrip();
                  wrapJSONTrip = (JSONTrip)JSON.deserialize(reqBody,JSONTrip.class); 
                  trpDetail = wrapJSONTrip.details;
                  sucess =true;
                  if(trpDetail != null){
                      for(TripDetails t:trpDetail){
                          t.userName = trp.First_Name__c+' '+trp.Last_Name__c;
                          t.userId = trp.User_Id__c;
                          if(trp.Submitted_Date__c!=null){
                              t.submittedDate = trp.Submitted_Date__c.format();
                          }
                          Long longtime = Long.valueOf(t.dttime.trim());   
                          DateTime dt = DateTime.newInstance(longtime);    
                          t.dttime = dt.format('MM/dd/yyyy hh:mm:ss');
                      }
                      Integer i=0;
                      List<TripDetails> tmpList = new List<TripDetails>();
                      for(TripDetails td:trpDetail){
                          if(i<10000){                      
                              tmpList.add(td);
                          } else { 
                              trpDetailForExport.add(tmpList);
                              tmpList = new List<TripDetails>();
                              tmpList.add(td);
                              i=0;
                          }                                            
                          i++;
                      }
                      trpDetailForExport.add(tmpList);   
                  }
            } catch(System.CalloutException e) {
                  //Exception handling goes here....
                  error = true;
                  message = e.getMessage();
            }catch(Exception ex){
                  error = true;
                  message = ex.getMessage();
          }  
        } else {
            error = true;
            message = 'No Trip Id provided';
        } 
        system.debug('size is '+trpDetailForExport.size());
        for(List<TripDetails> t:trpDetailForExport){
            system.debug('Size is for rec '+t.size());
        }
        return null;
        
    }
    public class JSONTrip{
        List<TripDetails> details; 
        JSONTrip(){
            details = new List<TripDetails>();
        }
    }
    public class TripDetails{
        public String dttime {get; set;}
        public String lat{get; set;}
        public String longitude{get; set;}
        public String userName {get; set;}
        public String userId {get; set;}
        public String submittedDate {get; set;}
        
    }   
    
}


Test Class

@isTest
public class VFC02_ExportToCSV_TEST{
        private class Mock implements HttpCalloutMock {
            public HTTPResponse respond (HTTPRequest req) {
                HTTPResponse res = new HTTPResponse();                
                String temp = String.valueOf(req);
                if(temp.contains('CalloutException')){
                    res.setStatusCode(400);
                    CalloutException e = (CalloutException)CalloutException.class.newInstance();
                    e.setMessage('Unauthorized endpoint, please check Setup->Security->Remote site settings.');
                    throw e;
                    res.setStatus('Bad request');
                    res.setBody('');
                }
                if(temp.contains('SystemException')){
                    res.setStatusCode(400);
                    res.setStatus('Bad request');
                    res.setBody('');
                }
                else{
                    res.setStatusCode(200);
                    res.setBody('{"details": [{"datetime": "1440083090761","lat": "34.1320843","lng": "-84.2131297"}]}');
                }
                return res;
            }
        }
    static testMethod void exportToCSVTest(){      
           PageReference pageRef = Page.VFP02_ExportToCSV;
           String tripId = 'ABCDE';
           insert AP41_SMT_DataFactory.getATrip();
           Test.setCurrentPage(pageRef);
           ApexPages.currentPage().getParameters().put('Id','2934bd04-50c5-4000-a3b0-5b10f86215c3'); 
           ApexPages.StandardController cont = new ApexPages.StandardController(new Trip_Summary__c());
           VFC02_ExportToCSV exportResult = new VFC02_ExportToCSV();           
           Test.setMock(HttpCalloutMock.class, new Mock());
           Test.startTest();
           exportResult.exportToCSVnew();
           system.assertEquals(1,exportResult.trpDetail.size());
           Test.stopTest(); 
    
    }
    static testMethod void exportToCSVTestNegative(){       
           PageReference pageRef = Page.VFP02_ExportToCSV;
           String tripId = 'ABCDE';
           insert AP41_SMT_DataFactory.getATrip();
           Test.setCurrentPage(pageRef);
           ApexPages.currentPage().getParameters().put('Id',null); 
           ApexPages.StandardController cont = new ApexPages.StandardController(new Trip_Summary__c());
           VFC02_ExportToCSV exportResult = new VFC02_ExportToCSV(cont);           
           Test.setMock(HttpCalloutMock.class, new Mock());
           Test.startTest();
           exportResult.exportToCSVnew();
           system.assertEquals(null,exportResult.trpDetail);
           Test.stopTest(); 
    
    }
    static testMethod void exportToCSVTestInvalidId(){       
           PageReference pageRef = Page.VFP02_ExportToCSV;
           String tripId = 'ABCDE';
           insert AP41_SMT_DataFactory.getATrip();
           Test.setCurrentPage(pageRef);
           ApexPages.currentPage().getParameters().put('Id','12345'); 
           ApexPages.StandardController cont = new ApexPages.StandardController(new Trip_Summary__c());
           VFC02_ExportToCSV exportResult = new VFC02_ExportToCSV(cont);            
           Test.setMock(HttpCalloutMock.class, new Mock());
           Test.startTest();
           exportResult.exportToCSVnew();
           system.assertEquals(1,exportResult.trpDetail.size());
           Test.stopTest(); 
    
    }
    static testMethod void exportToCSVTestSendCalloutException(){       
           PageReference pageRef = Page.VFP02_ExportToCSV;
           String tripId = 'ABCDE';
           insert AP41_SMT_DataFactory.getATrip();
           Test.setCurrentPage(pageRef);
           ApexPages.currentPage().getParameters().put('Id','CalloutException'); 
           ApexPages.StandardController cont = new ApexPages.StandardController(new Trip_Summary__c());
           VFC02_ExportToCSV exportResult = new VFC02_ExportToCSV(cont);            
           Test.startTest(); 
           Test.setMock(HttpCalloutMock.class, new Mock());
           exportResult.exportToCSVnew();
           system.assertEquals(0,exportResult.trpDetail.size());
           Test.stopTest(); 
    
    }
    static testMethod void exportToCSVTestSendSystemException(){       
           PageReference pageRef = Page.VFP02_ExportToCSV;
           String tripId = 'ABCDE';
           insert AP41_SMT_DataFactory.getATrip();
           Test.setCurrentPage(pageRef);
           ApexPages.currentPage().getParameters().put('Id','SystemException'); 
           ApexPages.StandardController cont = new ApexPages.StandardController(new Trip_Summary__c());
           VFC02_ExportToCSV exportResult = new VFC02_ExportToCSV(cont);            
           Test.startTest(); 
           Test.setMock(HttpCalloutMock.class, new Mock());
           exportResult.exportToCSVnew();
           system.assertEquals(0,exportResult.trpDetail.size());
           Test.stopTest(); 
    
    }
    static testMethod void exportToCSVTestTripDetails(){       
           PageReference pageRef = Page.VFP02_ExportToCSV;
           String tripId = 'ABCDE';
           insert AP41_SMT_DataFactory.getATrip();
           Test.setCurrentPage(pageRef);
           ApexPages.currentPage().getParameters().put('Id','SystemException'); 
           ApexPages.StandardController cont = new ApexPages.StandardController(new Trip_Summary__c());
           VFC02_ExportToCSV exportResult = new VFC02_ExportToCSV(cont);            
           Test.startTest(); 
           VFC02_ExportToCSV.TripDetails testTrip = new VFC02_ExportToCSV.TripDetails();
           testTrip.lat = 'lat';
           testTrip.longitude = 'longitude';
           system.assertEquals(null,exportResult.trpDetail);
           Test.stopTest(); 
    
    }
}
Hi All,

  I need to display more than 50000 in the page block table, Below is the code
VF page

<apex:page title="Trip Summary Details" sidebar="false" docType="html-5.0" tabStyle="Export_Trip_Details__tab" standardController="Trip_Summary__c" extensions="VFC01_ExportTripDetail" Readonly="true">
  <apex:form >
  <apex:pageMessages id="errors" />    
  <apex:pageBlock title="Export Trip details">
    <apex:pageBlockSection title="Filters" columns="2" collapsible="false" >
      <h1>Please choose a range of dates</h1>
      <apex:inputHidden />
      <apex:input type="date" value="{!startDate}" label="Start Date"/>
      <apex:input type="date" value="{!endDate}" label="End Date"/> 
      <apex:inputText value="{!lastName}" label="Last Name"/>
      <apex:inputText value="{!firstName}" label="First Name"/>
      <apex:inputText value="{!userId}" label="User ID"/>
      <apex:selectList value="{!country}"  size="1" label="Country">
          <apex:selectOption itemValue="US" itemLabel="United States"/>
          <apex:selectOption itemValue="CA" itemLabel="Canada"/>
      </apex:selectList>
      <apex:inputHidden />
      <apex:actionStatus id="actStatusId" >
        <apex:facet name="start" >
          <img src="{!$Resource.SMT_Loading}"/>                    
        </apex:facet>
      </apex:actionStatus>
      <apex:commandButton status="actStatusId" reRender="trppanel" value="Get Results" action="{!search}"/>      
    </apex:pageBlockSection>  
     <apex:outputPanel id="trppanel">
        <apex:pageBlockSection id="trpDetails" title="Results Trip Details" rendered="{!isResult}" collapsible="false" columns="1">
         <apex:pageblockTable value="{!tripSummary}" var="a">  
             <apex:column value="{!a.Trip_Id__c}"/>
             <apex:column value="{!a.First_Name__c}"/>
             <apex:column value="{!a.Last_Name__c}"/>
             <apex:column value="{!a.User_Id__c}"/>  
             <apex:column value="{!a.Submitted_Date__c}"/>
             <apex:column value="{!a.Total_Business_Miles__c}"/>            
             <apex:column headerValue="Action" >    
             <apex:commandLink rerender="trppanel" value="Export To CSV" styleClass="btn" style="color:block;text-decoration:none" onclick="javascript:openPopupFocus('/apex/VFP02_ExportToCSV?id={!a.Trip_Id__c}&cty={!country}');"/>
         </apex:column>
        </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:outputPanel>
   </apex:pageBlock>   
  </apex:form> 
 </apex:page>
Controller Class

public with sharing class Exportl{  
   private ApexPages.StandardController controller {get; set;}
   public boolean isResult {get;set;}
   public list <Trip_Summary__c> tripSummary {get;set;}
   public Date startDate {get;set;}
   public Date endDate {get;set;}
   public string lastName {get;set;}  
   public string firstName {get;set;}  
   public string userId {get;set;}
   public string country {get;set;}
   private String searchquery{get;set;}
    public Export() {    }    
   public Export(ApexPages.StandardController controller) {
    //initialize the stanrdard controller
       this.controller = controller; 
       isResult = false;
       startDate = System.Today();
       endDate = System.Today();
   }
    public void search(){  
        boolean oneCond = false;
        searchquery='select Trip_Id__c,Salesforce_User__c,First_Name__c, Last_Name__c, User_Id__c, Submitted_Date__c,Submitted_Datetime__c, Total_Business_Miles__c from Trip_Summary__c ';
        if(!userId.equals('')){
            searchquery = searchquery+'where User_Id__c =:userId';
            oneCond=true;            
        }        
        if(!firstName.equals('')){
            if(oneCond){
                searchquery = searchquery+' AND First_Name__c =:firstName';
            } else {
                searchquery=searchquery+'where First_Name__c =:firstName';
                oneCond=true; 
            }
        }
        if(!lastName.equals('')){
            if(oneCond){
                searchquery = searchquery+' AND Last_Name__c =:lastName';
            } else {
                searchquery=searchquery+'where Last_Name__c =:lastName';
                oneCond=true; 
            }
        }
        if(!country.equals('')){
            if(oneCond){
                searchquery = searchquery+' AND Region_Code__c =:country';
            } else {
                searchquery=searchquery+'where Region_Code__c =:country';
                oneCond=true; 
            }
        }
        if(startDate!=null && endDate!=null){
            if(oneCond){
                searchquery = searchquery+' AND Submitted_Date__c >= :startDate AND Submitted_Date__c <= :EndDate';
            } else {
                searchquery=searchquery+'where Submitted_Date__c >= :startDate AND Submitted_Date__c <= :EndDate';
                oneCond=true; 
            }
        }
      tripSummary= Database.query(searchquery);
      isResult = true;  
   }

Hi All,
Disposition creation on lead record we are creating a task record for that. I wrote a logic on task trigger to capture lead status while task record creating. On task records creation we are capturing lead memberid, date and status from associated lead. Issue is task record lead status field is not matching with current lead status. Lead status is updating after task record creates task record, so task record lead status is not matching with current lead status. Please help me out how to match task lead status with current lead status.
below is the code logic written on Task tirgger handler 

 Map<id,Lead> mapLead = new Map<id,Lead>([SELECT ID,Name,CompName_HF__c, Membbno_HF__c,Recertdate_HF__c,Status FROM Lead Where id IN:lstLeadId]);
          for(Task objTask : lstNewTaskMap)
          {
              if(objTask.Task_Created_Profile_Name__c.contains('ORS'))
                {
                    System.debug(' Entered into Lead loop' );
                    if(objTask.Subject <> NULL && objTask.Subject.contains('Call') && objTask.Status=='Completed')
                    { 
                     System.debug(' Entered into Task Type loop' );
                      objTask.TaskSubtype=Static_Variables_Retention_HF.Task_SubType;
              
                }
                      if(objTask.whoid==null) continue;
                if(mapLead.get(objTask.whoid)==null) continue;
                if(objTask.WhoId <> NULL && objTask.WhoId.getSobjectType() == Lead.getSObjectType())
                  {
                  Lead objLead = mapLead.get(objTask.whoid);
                      system.debug('***** objLead '+ objLead);
            
                        if(objTask.Type != null && objTask.Type.contains('Call'))
                        { 
                               objTask.TaskSubtype=Static_Variables_Retention_HF.Task_SubType;
                
                        }
                            objTask.RecordTypeId=Static_Variables_Retention_HF.taskRetentionRTID;
                              system.debug('objLead.Membbno' + objLead.Membbno_HF__c);
                            objTask.Lead_MemberId_HF__c=objLead.Membbno_HF__c;
                              system.debug('objTask.LeadMemberId' + objTask.Lead_MemberId_HF__c);
                                objTask.Lead_Status_HF__c=objLead.Status;
                              system.debug('objTask.LeadStatus' + objTask.Lead_Status_HF__c);


 
HI,

  Am trying to restrict phone no to 10 digits and i should accept format either (999) 999-9999 or 999-999-9999 or 999999999.
I wrote below validation 
AND(
    NOT(ISBLANK(Prescriber_Phone_Number_Last_Fill_Date__c)),
    NOT(
        OR(
            ISNUMBER(Prescriber_Phone_Number_Last_Fill_Date__c ),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c,"[0-9]{3}-[0-9]{3}-[0-9]{4}"),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c, "\\D*?(\\d\\D*?){10}"),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c, "[0-9]{10}")
        )
    )
)    

It is allowing more than 10 and Alphabets .

 Can somebody help me how to fix this?
 
Hi All,

Based on condition, value should store on sring. Present formula writtens below way

totalBusinessDistance = String.valueOf((Decimal)ar.get('totalBusinessDistance')-(2*(Decimal)ar.get('totalCommutingMiles')));
  
 Presently  totalBusinessDistnece storing value of totalBusinessDistance- 2*totalCommutingMiles.  Now want to be if (totalBusinessDistance- 2*totalCommutingMiles) value comes below 0 then totalBusinessDistance store only 0 other wise it  should store (totalBusinessDistance- 2*totalCommutingMiles).