• raghunaadh gunnam
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hey Community,

First of all,  I'm pretty new to salesforce.

 

Description of my project :

 

  • I have a single  custom object called 'AccountPlan__c'  it has about 164 fields for dates etc.
  • The object ist linked to a Account by a Master Detail field
  • All fields are shown on a custom page.
  • I also have a apex class with an extension

 

Everything works fine i can save the object, no problems.

But now i want to go the next step: live system.

So i need a test class for my apex class.

I tried really hard to setup a test class but after some day's of trying and a lot of search on Salesforce.com i dont know what to do.

I created new users and Account Plan's but i think I'm running in the wrong direction.

its maybe very simple but like i said, im just a greenhorn and i have to learn everything on my own.

 

here is my apex Class:

 

 

public class newAccountPlan {

  
    public final AccountPlan__c addPlan;   
    public List<Contact> accountContact;   
    public apexpages.standardController controller {get; set;}
  
    public newAccountPlan(ApexPages.StandardController stdController)
    {
      controller = stdController;
        this.addPlan = (AccountPlan__c)Controller.getRecord();
  
    }  
        public List<Contact> getaccountContact()
    {
      string account_id_st = addPlan.Account__c;
         accountContact = [Select id, Name,ReportsTo.Id, Title, ReportsTo.Name, Account.Id from Contact where Account.Id = :account_id_st];
        
        return accountContact;
    } 
            
    public PageReference save()
    {
       try{
            update addplan;
         }
    catch(DmlException ex){
        ApexPages.addMessages(ex);
        }
            return null;
        }   
}
  • the class is searching for a for a reporting structure of my SF account and gives it back for an Org Chart 

I really would appreciate every little comment.

Thanks a lot!!

 

Austin, Texas (I'm a German intern please excuse my grammar ) :smileywink: