• Mpalai
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

Hello Everybody,

 

I have implemented a scheduler in sandbox and it is working fine and also it shows 80% coverage in sandbox.

But when I try to move it to production ,it shows system.exception null  in this line.

 

System.schedule('Run at 4 pm Everyday', '0 0 16 * * ?', new SFAOppScheduler());

 

So can any one advice me, what might be wrong in production or there is some other issue.

 

Thanks 

Mrutyunjay

 

  • February 26, 2010
  • Like
  • 0

Hi all,

 

I want to show some message to user about  used storage space and free space.

How can I do it in apex,is it possible or not.

 

 

Thanks

Mrutyunjay

 

  • December 17, 2009
  • Like
  • 0

Hi all,

 

I am using document object to store some images in my apex class.

 

But this creates some issue in test class like after insert statement in apex class ,the remaining

code  is not  covered.

 

Code is like this.

 

 public Document img1 {get;set;} 

 

  public PageReference doSave()

     {

 

 

insert img1;

ImgID1 = img1.id; img1.body = null; GB.PartsImgID__c = ImgID1; GB.pID__c = ImgID2; insert GB; PageReference page1 = new PageReference('/'+GB.id); return page1;

 

 

 

After  "insert img1" statment remaining line are not covered ,there is not any exception in debug.

if I comment out this statement than it covered upto 90%.

 

 

 

 

  • October 14, 2009
  • Like
  • 0

I've set up a Send an Email button on my Account layout that will open the Send An Email screen and autopopulate the Primary Contact associated with the Account and a template based on some of the data in the Account record.

I would like to now set a date field on my Account record that marks the Email as having been sent after I click "Send" in the Send An Email screen.  Is there a way to accomplish this using Apex triggers?  I imagine if there's a way to trigger on an email being sent, it would simply be a matter of pulling the Account associated with the email and setting the appropriate Date field.  Any help would be greatly appreciated.

 

Best,
Steven

I am trying to get the selected checkboxes on a visualforce page.  I created a wrapper class, but when run my page, I get the following error:

 

Attempt to de-reference a null object, which occurs on the following line:

 

accountList.add(new aAccount(acct));

 

Here is the class file:

 

 

public class AccountHierarchyController extends AbstractSortableController { private List<Account> parent = new List<Account>(); public List<aAccount> accountList {get; set;} public String sortDir { get { return superSortDirection; } set { this.superSortDirection = value; } } public String sortExp { get { return superSortExpression; } set { this.superSortExpression = value; } } public void reSort() { accountList = new List<aAccount>(); } public AccountHierarchyController(ApexPages.StandardController stdController) { super(); superSortDirection = 'ASC'; superSortExpression = 'Name'; if(ApexPages.currentPage().getParameters().get('parentID') == '') { parent = [Select a.Service_Level_Code__c, a.Type, a.Parent__c, a.Name, a.Id, a.Description, a.Active_Subscriptions_at_Site__c, a.Active_Subscriptions__c, a.Active_Sites__c, a.Acct__c, a.Customer_ID__c, a.BillingCity, a.BillingState, a.Owner.Name, a.Customer_Name__c, a.Is_WAN_Base_Site__c, a.Service_Level_Description__c, a.WAN_Base_Site__c, a.WAN_Base_Site__r.Name, a.Future_End__c, a.Contract_End__c, a.Next_Service_Booking__c From Account a where Id = :stdController.getId()]; } else { parent = [Select a.Service_Level_Code__c, a.Type, a.Parent__c, a.Name, a.Id, a.Description, a.Active_Subscriptions_at_Site__c, a.Active_Subscriptions__c, a.Active_Sites__c, a.Acct__c, a.Customer_ID__c, a.BillingCity, a.BillingState, a.Owner.Name, a.Customer_Name__c, a.Is_WAN_Base_Site__c, a.Service_Level_Description__c, a.WAN_Base_Site__c, a.WAN_Base_Site__r.Name, a.Future_End__c, a.Contract_End__c, a.Next_Service_Booking__c From Account a where Id = :ApexPages.currentPage().getParameters().get('parentID')]; } if(parent.size() > 0) { if(parent[0].Future_End__c == null)parent[0].Future_End__c = parent[0].Contract_End__c; //get consolidated end date } } public List<aAccount> getDistrict() { if(parent.size() > 0) { //Get district accounts String query = 'Select a.Service_Level_Code__c, a.Type, a.ParentId, a.Name, a.Id, a.Description, a.Active_Subscriptions_at_Site__c, a.Active_Subscriptions__c, a.Active_Sites__c, a.Acct__c, a.Customer_ID__c, a.BillingCity, a.BillingState, a.Owner.Name, a.Customer_Name__c, a.Is_WAN_Base_Site__c, a.Service_Level_Description__c, a.WAN_Base_Site__c, a.WAN_Base_Site__r.Name, a.Future_End__c, a.Contract_End__c, a.Next_Service_Booking__c From Account a where '; query += 'a.ParentId = \'' + parent[0].Id + '\' order by ' + superSortExpression + ' ' + superSortDirection + ', a.Name ' + superSortDirection; for (Account acct : Database.query(query)) { if(acct.Future_End__c == null)acct.Future_End__c = acct.Contract_End__c; //get consolidated end date accountList.add(new aAccount(acct)); } } return accountList; } public PageReference processRenewalUpdates() { return null; } public List<Account> getParent() {return parent;} public String getParentName() {return parent[0].Name;} public String AccountID { get; set; } public class aAccount { public Account acct {get; set;} public Boolean selected {get; set;} public aAccount(Account a) { acct = a; selected = false; } } }

 

 

Here is the VF page:

 

<apex:page title="Account Hierarchy" StandardController="Account" sidebar="false" extensions="AccountHierarchyController" tabStyle="Account"> <apex:stylesheet value="{!$Resource.SmallTableCSS}"/> <apex:sectionHeader title="Account Hierarchy:" subtitle="{!ParentName}"/> <apex:pageBlock > <apex:pageBlockTable value="{!Parent}" var="account" id="theTable1" rowClasses="odd,even"> <apex:column > <apex:facet name="header"> Parent Account Name </apex:facet> <apex:outputLink value="/{!account.Id}">{!account.Name}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header">Account Number</apex:facet> <apex:outputLink value="/{!account.Id}">{!account.Customer_ID__c}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header">End Date</apex:facet> <apex:outputText value=" {!account.Future_End__c}"/> </apex:column> <apex:column > <apex:facet name="header">Type</apex:facet> <apex:outputText value="{!account.Type}"/> </apex:column> <apex:column > <apex:facet name="header">Wan Base Site</apex:facet> <div align="center"><apex:image value="{!$Resource.IconCheckmarkPng}" rendered="{!account.Is_WAN_Base_Site__c}" /></div> <apex:outputLink value="/{!account.WAN_Base_Site__r}">{!account.WAN_Base_Site__r.Name}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header">Billing City/State</apex:facet> <apex:outputText value="{!account.BillingCity}, {!account.BillingState}"/> </apex:column> <apex:column > <apex:facet name="header">Owner</apex:facet> <apex:outputText value="{!account.Owner.Name}"/> </apex:column> <apex:column > <apex:facet name="header">Next Training</apex:facet> <apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!account.Next_Service_Booking__c}" /> </apex:outputText> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:actionStatus id="catStatus" stopText=""> <apex:facet name="start"><apex:image id="img" value="{!$Resource.AjaxLoading}" /></apex:facet> </apex:actionStatus> <apex:form id="pageForm"> <apex:pageBlock id="pgBlock"> <apex:PageBlockButtons location="both" > <apex:commandButton value="Update Renewal Information" action="{!processRenewalUpdates}" /> </apex:PageBlockButtons> <apex:pageBlockTable value="{!District}" var="a" id="theTable2" rowClasses="odd,even"> <apex:column > <apex:facet name="header"> Select </apex:facet> <apex:inputCheckbox value="{!a.selected}" /> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Account Name{!IF(sortExp=='Name',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="Name" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputLink value="/{!a.acct.Id}">{!a.acct.Name}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Account Number{!IF(sortExp=='a.acct.Customer_ID__c',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.Customer_ID__c" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputLink value="/{!a.acct.Id}">{!a.acct.Customer_ID__c}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Service Level Description{!IF(sortExp=='a.acct.Service_Level_Description__c',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.Service_Level_Description__c" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputText value=" {!a.acct.Service_Level_Description__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="End Date{!IF(sortExp=='a.acct.Future_End__c',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.Future_End__c" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputText value=" {!a.acct.Future_End__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Type{!IF(sortExp=='a.acct.Type',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.Type" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputText value=" {!a.acct.Type}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Wan Base Site{!IF(sortExp=='a.acct.WAN_Base_Site__r.Name',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.WAN_Base_Site__r.Name" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <div align="center"><apex:image value="{!$Resource.IconCheckmarkPng}" rendered="{!a.acct.Is_WAN_Base_Site__c}" /></div> <apex:outputLink value="/{!a.acct.WAN_Base_Site__r}">{!a.acct.WAN_Base_Site__r.Name}</apex:outputLink> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Billing City/State{!IF(sortExp=='a.acct.BillingCity',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.BillingCity" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputText value="{!a.acct.BillingCity}, {!a.acct.BillingState}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Owner{!IF(sortExp=='a.acct.Owner.Name',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.Owner.Name" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputText value="{!a.acct.Owner.Name}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink reRender="pgBlock" status="catStatus" action="{!reSort}" value="Next Training{!IF(sortExp=='a.acct.Next_Service_Booking__c',IF(sortDir='ASC','▲','▼'),'')}"> <apex:param value="a.acct.Next_Service_Booking__c" name="column" assignTo="{!sortExp}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!a.acct.Next_Service_Booking__c}" /> </apex:outputText> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

I can't identify what is causing the null reference exception? 

 

Thanks.

Message Edited by bohemianguy100 on 03-10-2010 09:38 AM
Message Edited by bohemianguy100 on 03-10-2010 09:41 AM
Message Edited by bohemianguy100 on 03-10-2010 09:46 AM