Completed my first Apex Class extension for a visual force page. It works great in the sandbox. Unfortunately I get a code coverage failure when trying to upload to production.
Questions...
- Does the code coverage failure have to do with the entire org or just the Change Set Components?
- If it is just the Change Set Components how to I get code coverage for my new Apex Class?
I've been going through documentation but haven't found what I needed. I'd appreciate if anyone can narrow my search.
Here is my Apex Class code
public with sharing class SaveExtension
{
ApexPages.StandardController sc;
public AVTRRT__Job__c objBJob {get; set;}
public SaveExtension(ApexPages.StandardController sc)
{
this.sc = sc;
objBJob = [
select Job_Name__c, Job_Type__c, Ops_Notes__c, Recruiter_notes__c, Submission_notes__c, AVTRRT__Stage__c
from AVTRRT__Job__c
where Id in ( Select AVTRRT__Job__c from AVTRRT__Job_Applicant__c where Id = :sc.getId())];
}
public ApexPages.PageReference SaveBoth()
{
update objBJob;
return sc.Save();
}
}
Here is the VF page
<apex:page StandardController="AVTRRT__Job_Applicant__c" extensions="SaveExtension">
<apex:form >
<apex:pageblock mode="edit">
<apex:inputField value="{!AVTRRT__Job_Applicant__c.AVTRRT__Stage__c}" />
<apex:inputField value="{!objBJob.Job_Type__c}" />
<apex:CommandButton action="{!saveboth}" value="Save"/>
</apex:pageblock>
</apex:form>
</apex:page>
Thanks!
Ed L