• bj9
  • NEWBIE
  • 0 Points
  • Member since 2013

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

Hello,

 

I have been following the Apex Workbook (which is awesome btw) and I have been developing some very basic visualforce pages (as given in the book).

 

But to access my visualforce page everytime I have to type in

 

https://c.ap1.visual.force.com/apex/catalog

 

Is there a way by which I can call this page from a custom button may be ?

 

 

  • April 12, 2013
  • Like
  • 0

public class StoreFrontController {

    List<DisplayMerchandise> products;
    
    public List<DisplayMerchandise> getProducts() {
        if(products == null) {
            products = new List<DisplayMerchandise>();
            for(Merchandise__c item : [
                    SELECT Id, Name, Description__c, Price__c, Total_Inventory__c
                    FROM Merchandise__c]) {
                products.add(new DisplayMerchandise(item));
            }
        }
        return products;
    }
    
    // Inner class to hold online store details for item    public class DisplayMerchandise {

        private Merchandise__c merchandise;
        public DisplayMerchandise(Merchandise__c item) {
            this.merchandise = item;
        }

        // Properties for use in the Visualforce view        public String name {
            get { return merchandise.Name; }
        }
        public String description {
            get { return merchandise.Description__c; }
        }
        public Decimal price {
            get { return merchandise.Price__c; }
        }
        public Boolean inStock {
            get { return (0 < merchandise.Total_Inventory__c); }
        }
        public Integer qtyToBuy { get; set; }
    }
}

 

This code snippet is obtain from Apex Workbook online Chapter 3, Tutorial #17 and Lessonr #5 "Using Inner Classes in an Apex Controller"

 

When I try to save this class I get an error saying

"Invalid Constructor Name : DisplayMerchandise" (line 20)

 

I have highlighted the line in red for easy reference.

 

Can someone tell me whats the issue with the class code ?

 

 

  • April 10, 2013
  • Like
  • 0

I am learning Apex  and I have been executing dozens of anonymous apex code blocks over the past few days.

 

After executing every time, I have to type in "DEBUG" in the Filter in Execution Log to see my output.

Is there anyway by which I can save the exection log with the filter criteria so that I dont have to type "DEBUG" every time.

 

Please see screeshots.

 

--This is how the execution log looks after executing anon code block...

 

http://i.imgur.com/7uj2LLn.png

 

--This is what I want..see the filter criteria


http://i.imgur.com/GAtLFjK.png

 

 

  • April 08, 2013
  • Like
  • 0

public class StoreFrontController {

    List<DisplayMerchandise> products;
    
    public List<DisplayMerchandise> getProducts() {
        if(products == null) {
            products = new List<DisplayMerchandise>();
            for(Merchandise__c item : [
                    SELECT Id, Name, Description__c, Price__c, Total_Inventory__c
                    FROM Merchandise__c]) {
                products.add(new DisplayMerchandise(item));
            }
        }
        return products;
    }
    
    // Inner class to hold online store details for item    public class DisplayMerchandise {

        private Merchandise__c merchandise;
        public DisplayMerchandise(Merchandise__c item) {
            this.merchandise = item;
        }

        // Properties for use in the Visualforce view        public String name {
            get { return merchandise.Name; }
        }
        public String description {
            get { return merchandise.Description__c; }
        }
        public Decimal price {
            get { return merchandise.Price__c; }
        }
        public Boolean inStock {
            get { return (0 < merchandise.Total_Inventory__c); }
        }
        public Integer qtyToBuy { get; set; }
    }
}

 

This code snippet is obtain from Apex Workbook online Chapter 3, Tutorial #17 and Lessonr #5 "Using Inner Classes in an Apex Controller"

 

When I try to save this class I get an error saying

"Invalid Constructor Name : DisplayMerchandise" (line 20)

 

I have highlighted the line in red for easy reference.

 

Can someone tell me whats the issue with the class code ?

 

 

  • April 10, 2013
  • Like
  • 0