• Jakson Monteiro
  • NEWBIE
  • 20 Points
  • Member since 2014
  • Student Computer Application
  • Wipro Technologies

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 7
    Replies
Not able to get coverage for the below code in bold.

global class RS_DeleteExportRecords  implements Database.Batchable<sObject>, Schedulable{
   global final String Query;
    global RS_DeleteExportRecords (){
        
    }

    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator([select id from RS_Export__c where CreatedDate != Today]);
    }

    global void execute(Database.BatchableContext BC,List<RS_Export__c> scope){
        delete scope;
    }
I m not able to get the Test Coverage for only Database.emptyRecycleBin in my Test class

Below is my code snippet where i am not able to get coverage in my Apex Class
    global void execute(Database.BatchableContext BC, list<Application__c > scope){     
        delete scope;   
        DataBase.emptyRecycleBin(scope); 
    }

Below is my Test Class:

@isTest(SeeAllData=true)
public class RS_PurgeRecycleBinApplicationTest
{
  static testMethod void RS_PurgeRecycleBin()
  {
   test.StartTest();
   Application__c app=new Application__c();
   app.Application_Status__c='Paper';
   app.GUID__c='1111';
   Insert app;
   
   List <Application__c> delApp=new List<Application__c>([Select Id from Application__c where GUID__c='1111']);
   Delete delapp;
     
     
   test.StopTest();
   
   
    RS_PurgeRecycleBinApplication batchtest=new RS_PurgeRecycleBinApplication();
      Database.executeBatch(batchtest);
      
      
      RS_PurgeRecycleBinApplication schedulebatch=new RS_PurgeRecycleBinApplication();
      String cronExp = '0 15 0 * * ? 2099';
      String jobId = System.schedule('testRS_Scheduled', cronExp, schedulebatch);  
  }
  
  
  }
Can we write a batch class and schedule class in the same class. is it possible ?
The Visualforce page must be named 'ShowAssistantInfo'.
The Visualforce page must use the Contact standard controller.
The Visualforce page must use the respective Contact standard fields to display the assistant's name and phone number.
The Visualforce page must display the assistant's phone number using a 'tel:' hyperlink.
The object-specific action on the Contact object must be labeled 'Call Assistant'.
The 'Call Assistant' action must use the 'ShowAssistantInfo' Visualforce page.
The 'Call Assistant' action must be added to the 'Contact Layout' page layout.


I have created the visualforce page and the Action for the Contact Layout but still shows the error :

Challenge not yet complete... here's what's wrong: 
The 'Call Assistant' action wasn't added to the Contact page layout.
How can i query to find all accounts  records that have been created last hour before. Like if we load data in salesforce at 1pm using a external tool  how can i query in salesforce and check the count of all the records created at that specific time. I know salesforce has date literals but there is nothing on hourly basis.
I want to integrate Google Maps to the Account page of Salesforce. Is there any good links to learn to do so.

I have checked many sample code but all of them were not working. Is there any other settings to be enabled for the Gmap to be shown in the Page.

 
Unable to complete the challenge for the Apex Trigger using Bulk
error:Executing against the trigger does not work as expected.

Trigger code:

trigger ClosedOpportunityTrigger on Opportunity (before insert,before update)
{
  List <task> taskinsert= new List<task>();
   for(Opportunity o: Trigger.new)
    {
     if(o.StageName=='Closed Won')
     {
         Task t= new Task();
         t.Subject='Follow up Task';
        t.whatid=o.id;
taskinsert.add(t);
          
     }
        

      
    }
    insert taskinsert;
    
}
trigger ClosedOpportunityTrigger on Opportunity (before insert,before update)
{
 
    for(Opportunity o: Trigger.new)
    {
     if(o.StageName=='Closed Won')
     {
         Task t= new Task();
         t.Subject='Follow up Task';
        t.whatid=o.id;
           insert t;
     }
        

      
    }
    
    
}
I have a Button on a Contact object that directs to a visual force page which should display the name of the contact which has clicked the object.
Along with the other details.
How can i achieve this.

Note I need to display the contact name on the section header also and in the Pageblock.
I have created a Scontrol in Salesforce can it be displayed in Salesforce1 ?
trigger AddAccount on Contact (before insert) 
{
 for (Contact c:Trigger.new )
 {
    Account a= new Account();
    a.Name='ACME';
    a.ID=c.AccountID;
    
    insert a;
 
 }

}


how can i link a Account to a contact ??
We have two fields criteria and gap which needs to be calculated in Account. both the fields are formula fields.

Criteria checks two things. First it checks for the account Type and than on the basis of the Type of account it checks the Region.

I have constructed the formula for one type of the Account(NON-SAVE) but i am not able to make one for the other type(SAVE) since formulas can be only of 5000 as a limit.both the types need to be calculated in the same formula.Is there any alternative way to do so.

CASE(
Typel__c , 'NON-SAVE',

CASE( Region__c,
'NSW/ACT', 85000,
'VIC/TAS',85000,
'QLD',85000,
'WA',75000,
'SA/NT', 60000,0
),

0) 

Once done with criteria field the Gap will be calculated after subtracting it.


Thanks in Advance
I m writiing a trigger to check the Billing address and Shipping address if the billing address is given and shipping address is not given than it matches shipping address with billing address.

I am not able to get access to Billingaddress or shipping address in account.

Throws a error:Compile Error: Data type not supported: Address at line 6 column 9

trigger AccountAddressTrigger on Account (after insert,after update)
 {
 
 for(Account a:Trigger.new)
 {
     if(a.BillingAddress!='')
     {
     
     }
     
          }
 
}
Hi Guys,

On Admi Trail-Beginner, I am now attempting the 'Extending reports using the appExchange'  topic under 'Reports and Dashboard' module. After refreshing the '3 - Sales & Marketing Adoption' dashboard and then clicking the 'Check Challenge' button i am getting the below error. Can anyone help me on this. I am unable to complete the trailhead beacuse of the below issue.

There was an unhandled exception. Please reference ID: MCZVMWKK. Error: Faraday::Error::ClientError. Message: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 30123183-94555 (-2087364227)

Appreciate your help.
Thanks in advance!
Hi,
please Explain with code to write Validations for phone number object..
I have a set of apex:inputText fields. I am trying to validate mandatory fields and display error messages next to fields. The code I have is:
 
<apex:page standardController="Case" extensions="MSAFTController" showHeader="false" standardStylesheets="true">
    
    <apex:includeScript id="script2" value="{!URLFOR($Resource.ChargentCases__CreditCardJS, 'bililiteRange.js')}" loadOnReady="false"/>
    <meta http-equiv="X-Frame-Options" content="deny" />
    <script>
        if( self == top ) {
            document.documentElement.style.display = 'block' ;
        } else {
            top.location = self.location ;
        }
    </script>

    <!--<apex:pageMessages id="msgs"/>-->
    
    <apex:outputPanel layout="block" styleClass="page">

    <apex:stylesheet value="{!URLFOR($Resource.ChargentCases__CreditCardJS, 'style.css')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.ChargentCases__CreditCardJS, 'sitepaymentStyle.css')}"/>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

    <style>
        @-moz-document url-prefix() {
            .ccjs-card .ccjs-expiration:after {
                top: 0em !important;
            }
        }
    </style>
    <apex:form id="frm">   
        <!--<apex:commandButton value="Submit Page" action="{!myMethod}"/>   -->
            <apex:panelGrid columns="1" styleClass="info" width="100%">
        <apex:pageBlock mode="edit" id="pblck">
            <!--<apex:pageblockbuttons >
                <apex:commandbutton value="Submit" action="{!submit}" />
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>-->
                
                    
            <apex:pageblocksection id="FTDetails" title="MSA Fast Track">
            
                <!--<div class="ccjs-card" id="innerForm">-->
                    <apex:panelGrid columns="1" styleClass="info" >
                 <apex:pageBlockSectionItem >
                    <!--<apex:outputLabel for="MSA Application Number">MSA Application Number</apex:outputLabel>-->
                        
                        
                     <apex:outputText value="MSA Application Number" />   
                        <apex:inputText value="{!case.MSA_Application_Number__c}" styleClass="inputText" />
                         
                        
                    <!--<apex:inputField id="msaAppNo" value="{!case.MSA_Application_Number__c}" />-->
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                        
                        
                        <apex:outputText value="Applicatnt's EA ID" /> 
                        <apex:outputPanel >
                        <div class="requiredInput" id="divInp">
                        <div class="requiredBlock" id="divReq"></div>
                        <!--apex:inputText value="{!case.Applicatnt_s_EA_ID__c}" id="appEAID" styleClass="inputText" required="true"/>-->
                        <apex:inputText value="{!msaAppEAID}" id="appEAID" styleClass="inputText" rendered="{!LEN(errorMessage)==0}"/>
                        <!--<apex:outputText id="errEAID" value="errorMessage" styleClass="classErrorClass" rendered="{!LEN(errorMessage)>0}"/>-->
                        <apex:outputPanel rendered="{!LEN(errorMessage)!=0}">
                         <apex:inputText styleClass="error" value="{!msaAppEAID}"/>
                         <div class="errorMsg"><strong>Error:</strong>&nbsp;{!msaAppEAID}</div>
                       </apex:outputPanel>  
                        </div>
                        </apex:outputPanel>
                        
                    <!--<apex:outputLabel for="Applicatnt's EA ID">Applicatnt's EA ID</apex:outputLabel>
                    <apex:inputField required="true" id="msaAppEAID" value="{!case.Applicatnt_s_EA_ID__c}" />-->
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>        
                <apex:pageBlockSectionItem >
                        
                        <apex:outputText value="Applicant's Full Name" />
                        <apex:outputPanel >
                        <div class="requiredInput">
                        <div class="requiredBlock"></div>
                        <apex:inputText value="{!case.Applicants_Full_Name__c}" styleClass="inputText" required="true"/>
                        <!--<apex:outputText id="errEAID" value="Error: You must enter a value" style="color:red;display:none"/>-->
                        <!--<apex:outputText value="{!errorMessage}" style="color:red;display:none" rendered="{!LEN(errorMessage)>0}"/>-->
                        </div>
                        </apex:outputPanel>
                    <!--<apex:outputLabel for="Applicant's Full Name">Applicant's Full Name</apex:outputLabel>
                    <apex:inputField required="true" id="msaAppFullName" value="{!case.Applicants_Full_Name__c}" />-->
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                         <apex:outputText value="Applicant's email address" />   
                        <apex:inputText value="{!case.Applicant_s_email_address__c}" styleClass="inputText" required="true"/>
                    <!--<apex:outputLabel for="Applicant's email address">Applicant's email address</apex:outputLabel>
                    <apex:inputField id="msaAppEmail" value="{!case.Applicant_s_email_address__c}" />-->
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                        <apex:outputText value="Payee's Full Name" />
                         <apex:outputPanel >
                        <div class="requiredInput">
                        <div class="requiredBlock"></div>
                        <apex:inputText value="{!case.Payees_Full_Name__c}" styleClass="inputText" required="true"/>
                        </div>
                        </apex:outputPanel>
                    <!--<apex:outputLabel for="Payees Full Name">Payees Full Name</apex:outputLabel>
                    <apex:inputField required="true" id="msaPayeeFN" value="{!case.Payees_Full_Name__c}" />-->
                        
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                         <apex:outputText value="Contact email address" />
                         <apex:outputPanel >
                        <div class="requiredInput">
                        <div class="requiredBlock"></div>
                        <apex:inputText value="{!case.Contact_email_address__c}" styleClass="inputText" required="true"/>
                        </div>
                        </apex:outputPanel>
                    <!--<apex:outputLabel for="Contact email address">Contact email address</apex:outputLabel>
                    <apex:inputField required="true" id="msaContactEmail" value="{!case.Contact_email_address__c}" />-->
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >        </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                        <apex:outputText value="Additional Information" />   
                        <apex:inputTextarea value="{!case.Additional_Information__c}"  required="true" rows="10"/>
                    <!--<apex:outputLabel for="Additional Information">Additional Information</apex:outputLabel>
                    <apex:inputField id="msaAddnlInfo" value="{!case.Additional_Information__c}" />-->
                </apex:pageBlockSectionItem>
                <apex:outputPanel layout="block" styleClass="btns">
                    <!--<apex:commandButton value="Submit" action="{!charge}"  rerender="msgs"/>-->
                    <apex:commandButton value="Submit" action="{!charge}" />    
                    <apex:commandButton value="Cancel" action="{!Cancel}"/>
                </apex:outputPanel> 
              </apex:panelGrid>
 <!-- onclick="if (!checkRequiredFields()) return false;" -->                       
            </apex:pageblocksection>
                          
                         
           <!--</div>-->
                        
                        
        </apex:pageBlock>
         
        </apex:panelGrid>
    </apex:form>
    </apex:outputPanel>
    <script type="text/javascript">
 
                        
</apex:page>

Controller:
 
public class MSAFTController {
    
    public String msaAppEAID {get;set;}
    public String errorMessage {get;set;}
    //public String classErrorClass {get;set;}
    
    
    public ApexPages.StandardController standardContactController;
    private string req_param;
    private Case msaCase;
   
    public MSAFTController.MSAFTController(ApexPages.StandardController controller){
        standardContactController = controller;
        msaCase =(Case) controller.getRecord();
        errorMessage = '';
    }
    
    public Id createCase(){
        Id ftRecTypeId = [SELECT Id from recordType where name='MSA Fast Track' and sObjectType='Case' LIMIT 1].id;
       
        Id ctId = [Select Id from Contact where EA_Member_No__c=: msaCase.Applicatnt_s_EA_ID__c LIMIT 1].Id;
        Id gatewayId = [Select Id from ChargentBase__Gateway__c where Name='eWay Gateway' LIMIT 1].Id;
        Case insCase = new Case();
        insCase.RecordTypeId = ftRecTypeId;
        insCase.Status = 'New';
        insCase.Origin = 'Web';
        insCase.ContactId = ctId;
        insCase.ChargentCases__Amount__c = 120.0;
        insCase.ChargentCases__Payment_Method__c = 'Credit Card';
        insCase.MSA_Application_Number__c = msaCase.MSA_Application_Number__c;
        //insCase.MSA_Application_Number__c = msaAppEAID;
        insCase.Applicants_Full_Name__c = msaCase.Applicants_Full_Name__c;
        insCase.Applicatnt_s_EA_ID__c = msaCase.Applicatnt_s_EA_ID__c;
        insCase.Applicant_s_email_address__c = msaCase.Applicant_s_email_address__c;
        insCase.Payees_Full_Name__c = msaCase.Payees_Full_Name__c;
        insCase.Contact_email_address__c = msaCase.Contact_email_address__c;
        insCase.Additional_Information__c = msaCase.Additional_Information__c;
       
        insCase.ChargentCases__Gateway__c = gatewayId;
        insert insCase;
        System.debug('insCaseId>>>' + insCase.Id);
        return insCase.Id;
    }
    
       
    public pageReference charge(){
        System.debug('Ind=side submit function*****************');
        if(msaAppEAID == '' || msaAppEAID == null){
            errorMessage = 'Required Field Empty';
        }
        //boolean errorInSave = validate();
        //System.debug('errorInSave >>>>>>>>>' + errorInSave);
        //if(errorInSave != true){
        Id caseId = createCase();
        
        /* Appfrontier Added */
        ChargentCases__Payment_Request__c pReq = [Select ChargentCases__Pay_Link__c From ChargentCases__Payment_Request__c Where ChargentCases__Case__c = :caseID And ChargentCases__Status__c != 'Paid'];
        
        Pagereference pr = New PageReference(pReq.ChargentCases__Pay_Link__c);
        return pr;
        //}
        
        /* End Appfrontier Add */
        /*
        req_param = apexPages.currentPage().getParameters().get('req');
        System.debug('req_param>>>' + req_param);
        //Pagereference pr1 = new Pagereference('/apex/ChargentCases_SitePayment');
        Pagereference pr = Page.MSA_CCDetailsPage;
        //Pagereference pr = Page.MSA_StartPage;
        pr.getParameters().put('req',caseId); 
        //pr1.getParameters().put('req','%2FLVo2VwkvkZp3PG61h2oGDuYMIpLmDd%2BvBl93XXn%2FKiHqplGvB5gbrkp7YJ4xIif3W1wDKcFZlfGrHHJPPeGwIMzcEQxld1nkulatNzGZB4%3D'); 
        //System.debug('pr1 in submit >>>' + pr1); 
        System.debug('pr in submit >>>' + pr);
        //pr.setRedirect(true);
        //ChargentCases.TChargentOperations.TChargentResult rs= ChargentCases.TChargentOperations.ChargeCase_Click(caseId );
       // System.debug('rs >>>>>' + rs);
        return pr;    
        */
    }
    
    /*public boolean validate() {
        boolean error = false;
        System.debug('In Validate>>>');
        System.debug('msaAppEAID>>>' + msaAppEAID);
        if ((insCase.Applicatnt_s_EA_ID__c == '') || (insCase.Applicatnt_s_EA_ID__c == null)) {
            System.debug('msaCase.Applicatnt_s_EA_ID__c is blank');
            classErrorClass = 'errorClass';  
            // put the errorclass, red borders<br>         
            errorMessage = 'Postal code not found'; 
            error = true;
            return error;
        } else {
            classErrorClass = '';
            errorMessage = ''; 
            error = false;
            return error;
        }
        return error;
       //return null;
        
    }*/

}

Currently I am trying this only for Applicatnt's EA ID field but when I click on Submit nothing happens. The debug statements in charge() are not called and nor is any error displayed. Am I missing anything here?

Thanks,
Vandana
I am attempting to edit my trailhead profile (time zone, company, email, etc...). Every time I hit save, I get a Visualforce page error. Does anyone else get this error? Visualforce error
The Visualforce page must be named 'ShowAssistantInfo'.
The Visualforce page must use the Contact standard controller.
The Visualforce page must use the respective Contact standard fields to display the assistant's name and phone number.
The Visualforce page must display the assistant's phone number using a 'tel:' hyperlink.
The object-specific action on the Contact object must be labeled 'Call Assistant'.
The 'Call Assistant' action must use the 'ShowAssistantInfo' Visualforce page.
The 'Call Assistant' action must be added to the 'Contact Layout' page layout.


I have created the visualforce page and the Action for the Contact Layout but still shows the error :

Challenge not yet complete... here's what's wrong: 
The 'Call Assistant' action wasn't added to the Contact page layout.
I have a Button on a Contact object that directs to a visual force page which should display the name of the contact which has clicked the object.
Along with the other details.
How can i achieve this.

Note I need to display the contact name on the section header also and in the Pageblock.
I have Service Order as custom object.In this i have start date as date field,service start time as date time field, and Attended by as Lookup of Technician object Name.Now my question is if start date,service start time and Attended by are same for the other record it have show error  message as duplication