• Elisabeth Doser
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 8
    Replies
I'm trying to complete my first deployment for go live tomorrow. Very new. I successfully deployed all the standard objects already (page layouts, profiles, etc). I have one VF page and one Apex Class to deploy. The deploy fails due to code coverage. I have 0% code coverage right now. I called support and they told me I need to have a test class. I've attempted to write one but I'm still not completely clear on the objective and I'm still stuck. Below is my class and my test class. The test class compiles but I'm still at 0% code coverage in sandbox. I need help! Supposed to go live tomorrow and I've just discovered all of this. I have limited time and need the fastest way to deploy. 

public class Quote_extension
{

//Global variables
Public Opportunity opp1  {get; set;}
Public Quote q;
Public ApexPages.StandardController stdCtrl;

public Quote_extension(ApexPages.StandardController controller)
{

    stdCtrl=controller; 
    
    Id opp = system.currentpagereference().getparameters().get('oppid');
    Id quoteid = system.currentpagereference().getparameters().get('id');
    System.debug('####$$$$$  ' + opp);
    if(opp!=null)
    {
         opp1 =[Select AccountId from Opportunity where id  =: opp ];
         System.debug('####$$$$$$$$  IF' + opp1);
    }
    else
    {
        Quote q =[Select OpportunityId from Quote where id  =: quoteid];
        opp1 = [Select AccountId from Opportunity where id  =: q.opportunityId];
        System.debug('####$$$$$$$$  ELSE' + opp1);
    }
 
     //pre-populate Conditions and Exclusions on new
     Quote q1 = (Quote)stdCtrl.getRecord();               
     Id recordId = stdCtrl.getId();
     if(recordId == null)
     {
        q1.Conditions_Exclusions__c = 'EXCLUSIONS \n'
        + '    * Protection of surrounding areas including walls, floors, finishes, furniture, fixtures and equipment \n' 
        + '    * Detailed cleaning, except vacuuming slurry and removal of concrete (if included in proposal) \n'     
        + '    * Covering of holes and openings \n'               
        + '    * Night, weekend, and holiday work \n'                                 
        + '    * Layout, access, protecting public from harms way, shoring and bracing, traffic control and barricades, and locating, cutting, capping, and protection of utilities \n'
        + '    * Patching and painting of adjacent surfaces \n'
        + '    * Permits and inspections \n'  
        + '    * Removal of any hazardous materials or generated debris \n'
        + '    * Temporary lighting and power \n'
        + '    * Testing of any hazardous materials \n'
        + '    * Utility location and protection \n'        
        + '    * Bonds, retainage and liquidated damages \n' + '\n'                         
        + ' CONDITIONS \n'
        + '    * Proposal is based on conditions described herein. Additional charges will apply with change of conditions. \n'
        + '    * Proposal based on using gas or diesel powered equipment. \n'
        + '    * One mobilization is included. Additional mobilizations will incur additional charges. \n'
        + '    * Proposal is based on over cuts being left in remaining concrete. \n'
        + '    * Standby or delays caused by others will be charged at an applicable hourly rate. \n'
        + '    * Quantities are estimated. Invoicing is based on actual field measured quantities. \n'
        + '    * Not responsible for any water damage that may occur. \n' 
        + '    * Live utilities clearly marked and made safe by others. \n'
        + '    * Any subsequent contract will be on AIA doc.401(1997 Edition), AGC doc.640 or will have Penhall Company contract addendum attached. \n';
     }
         
}  
    
}

Test Class
@isTest(SeeAllData=true)
public class TestQuoteDefaults {
    static testMethod void insertDefaultText() {
       
      Quote QuotetoCreate = new Quote();
       
       QuotetoCreate.Name = 'Quote Name Test';
       QuotetoCreate.OpportunityID = '006i000000O89xV';
       QuotetoCreate.Conditions_Exclusions__c = 'Inserting new text';
       
       System.debug('Text before insertion: ' + QuotetoCreate.Conditions_Exclusions__c);
     
       insert QuotetoCreate;
       
       QuotetoCreate = [SELECT Conditions_Exclusions__c FROM Quote WHERE Id =:QuotetoCreate.Id];
       System.debug('Text after insertion: ' + QuotetoCreate.Conditions_Exclusions__c);

       System.assertEquals('Inserting new text', QuotetoCreate.Conditions_Exclusions__c);
       }
       }

 
 I am overriding New Quote using the standardcontroller to expose the full functionality of the CKEditor (namely spell check). I have a couple issues. First, when I click New Quote from the Quotes related list, the Opportunity name appears but the Account name does not (the label does appear). Here are the inputFields I've defined. 

 <apex:inputField value="{!Quote.AccountID}"> </apex:inputField>
  <apex:inputField value="{!Quote.OpportunityID}"> </apex:inputField>

Second, the Opportunity is field being displayed as a lookup. I really want to keep the standard functionality on New Quote that prohibits changing Account or Opportunity when clicking New quote.

I've also overriden Edit to the same VF page. When I open an existing Quote, both values appear in the page properly.

Any suggestions would be greatly appreciated.
I'm trying to complete my first deployment for go live tomorrow. Very new. I successfully deployed all the standard objects already (page layouts, profiles, etc). I have one VF page and one Apex Class to deploy. The deploy fails due to code coverage. I have 0% code coverage right now. I called support and they told me I need to have a test class. I've attempted to write one but I'm still not completely clear on the objective and I'm still stuck. Below is my class and my test class. The test class compiles but I'm still at 0% code coverage in sandbox. I need help! Supposed to go live tomorrow and I've just discovered all of this. I have limited time and need the fastest way to deploy. 

public class Quote_extension
{

//Global variables
Public Opportunity opp1  {get; set;}
Public Quote q;
Public ApexPages.StandardController stdCtrl;

public Quote_extension(ApexPages.StandardController controller)
{

    stdCtrl=controller; 
    
    Id opp = system.currentpagereference().getparameters().get('oppid');
    Id quoteid = system.currentpagereference().getparameters().get('id');
    System.debug('####$$$$$  ' + opp);
    if(opp!=null)
    {
         opp1 =[Select AccountId from Opportunity where id  =: opp ];
         System.debug('####$$$$$$$$  IF' + opp1);
    }
    else
    {
        Quote q =[Select OpportunityId from Quote where id  =: quoteid];
        opp1 = [Select AccountId from Opportunity where id  =: q.opportunityId];
        System.debug('####$$$$$$$$  ELSE' + opp1);
    }
 
     //pre-populate Conditions and Exclusions on new
     Quote q1 = (Quote)stdCtrl.getRecord();               
     Id recordId = stdCtrl.getId();
     if(recordId == null)
     {
        q1.Conditions_Exclusions__c = 'EXCLUSIONS \n'
        + '    * Protection of surrounding areas including walls, floors, finishes, furniture, fixtures and equipment \n' 
        + '    * Detailed cleaning, except vacuuming slurry and removal of concrete (if included in proposal) \n'     
        + '    * Covering of holes and openings \n'               
        + '    * Night, weekend, and holiday work \n'                                 
        + '    * Layout, access, protecting public from harms way, shoring and bracing, traffic control and barricades, and locating, cutting, capping, and protection of utilities \n'
        + '    * Patching and painting of adjacent surfaces \n'
        + '    * Permits and inspections \n'  
        + '    * Removal of any hazardous materials or generated debris \n'
        + '    * Temporary lighting and power \n'
        + '    * Testing of any hazardous materials \n'
        + '    * Utility location and protection \n'        
        + '    * Bonds, retainage and liquidated damages \n' + '\n'                         
        + ' CONDITIONS \n'
        + '    * Proposal is based on conditions described herein. Additional charges will apply with change of conditions. \n'
        + '    * Proposal based on using gas or diesel powered equipment. \n'
        + '    * One mobilization is included. Additional mobilizations will incur additional charges. \n'
        + '    * Proposal is based on over cuts being left in remaining concrete. \n'
        + '    * Standby or delays caused by others will be charged at an applicable hourly rate. \n'
        + '    * Quantities are estimated. Invoicing is based on actual field measured quantities. \n'
        + '    * Not responsible for any water damage that may occur. \n' 
        + '    * Live utilities clearly marked and made safe by others. \n'
        + '    * Any subsequent contract will be on AIA doc.401(1997 Edition), AGC doc.640 or will have Penhall Company contract addendum attached. \n';
     }
         
}  
    
}

Test Class
@isTest(SeeAllData=true)
public class TestQuoteDefaults {
    static testMethod void insertDefaultText() {
       
      Quote QuotetoCreate = new Quote();
       
       QuotetoCreate.Name = 'Quote Name Test';
       QuotetoCreate.OpportunityID = '006i000000O89xV';
       QuotetoCreate.Conditions_Exclusions__c = 'Inserting new text';
       
       System.debug('Text before insertion: ' + QuotetoCreate.Conditions_Exclusions__c);
     
       insert QuotetoCreate;
       
       QuotetoCreate = [SELECT Conditions_Exclusions__c FROM Quote WHERE Id =:QuotetoCreate.Id];
       System.debug('Text after insertion: ' + QuotetoCreate.Conditions_Exclusions__c);

       System.assertEquals('Inserting new text', QuotetoCreate.Conditions_Exclusions__c);
       }
       }

 
Does anyone have similar problem? I have CKEditor enabled for my custom rich text area fields on a custom object. The CKEditor included in Salesforce does not work anymore. It refreshes page repeatedly and you can't edit anything.

My solution was to download CKEditor and put it as Static Resource but I had to find the appropriate version (tried 15 so far)...and only one seem to be working with current data - so that it doesn't change it. But I'm still working on it, and haven't found the best solution so far. Any suggestions? Raising a case on Salesforce didn't help me, they told me it should work.
 I am overriding New Quote using the standardcontroller to expose the full functionality of the CKEditor (namely spell check). I have a couple issues. First, when I click New Quote from the Quotes related list, the Opportunity name appears but the Account name does not (the label does appear). Here are the inputFields I've defined. 

 <apex:inputField value="{!Quote.AccountID}"> </apex:inputField>
  <apex:inputField value="{!Quote.OpportunityID}"> </apex:inputField>

Second, the Opportunity is field being displayed as a lookup. I really want to keep the standard functionality on New Quote that prohibits changing Account or Opportunity when clicking New quote.

I've also overriden Edit to the same VF page. When I open an existing Quote, both values appear in the page properly.

Any suggestions would be greatly appreciated.
My goal is to override the standard new quote button so that the expiration date on the quote defaults to today()+30. I don't want to use a workflow to accomplish this since I want the default expiration date to appear before the user saves the quote. I started creating the following visualforce page:

<apex:page standardController="Quote" showHeader="False" action="/0Q0/e?ExpirationDate={!TODAY()+30}
&oppid=006Z0000008JgXv">
</apex:page>

I got stuck because I don't know how to set the oppid to autopopulate with the associated opportunity id. I've just manually entered a static oppid  to test with. Does anyone know how I would modify this code to populate the associated opportunity id automatically?