• Heather Bazel
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hi all,

I need to embed my VF Custom Object into my Opportunity Page Layout, but not sure how to accomplish this. I know that the standardController points to the Custom Object, but how do I create a relationship with the Opportunity so that I am able to add it to the Opp Page Layouts? Below is my Controller and VF Code:

Controller: 
public class revRecMultiadd
{
    
    //will hold the rev rec records to be saved
    public List<Revenue_Recognition__c>lstRevRec  = new List<Revenue_Recognition__c>();
    
    //list of the inner class
    public List<innerClass> lstInner 
    {   get;set;    }
    
    //will indicate the row to be deleted
    public String selectedRowIndex
    {get;set;}  
    
    //no. of rows added/records in the inner class list
    public Integer count = 1;
    //{get;set;}
    
    
    ////save the records by adding the elements in the inner class list to lstAcct,return to the same page
    public PageReference Save()
    {
        PageReference pr = new PageReference('/apex/revRecMultiadd');
        
        for(Integer j = 0;j<lstInner.size();j++)
        {
            lstRevRec.add(lstInner[j].revrec);
        } 
        insert lstRevRec;
        pr.setRedirect(True);
        return pr;
    }
        
    //add one more row
    public void Add()
    {   
        count = count+1;
        addMore();      
    }
    
    /*Begin addMore*/
    public void addMore()
    {
        //call to the iner class constructor
        innerClass objInnerClass = new innerClass(count);
        
        //add the record to the inner class list
        lstInner.add(objInnerClass);    
        system.debug('lstInner---->'+lstInner);            
    }/* end addMore*/
    
    /* begin delete */
    public void Del()
    {
        system.debug('selected row index---->'+selectedRowIndex);
        lstInner.remove(Integer.valueOf(selectedRowIndex)-1);
        count = count - 1;
        
    }/*End del*/
    
    
    
    /*Constructor*/
    public revRecMultiadd(ApexPages.StandardController ctlr)
    {
    
        lstInner = new List<innerClass>();
        addMore();
        selectedRowIndex = '0';
        
    }/*End Constructor*/
        


    /*Inner Class*/
    public class innerClass
    {       
        /*recCount acts as a index for a row. This will be helpful to identify the row to be deleted */
        public String recCount
        {get;set;}
        
        
        public Revenue_Recognition__c revrec
        {get;set;}
        
        /*Inner Class Constructor*/
        public innerClass(Integer intCount)
        {
            recCount = String.valueOf(intCount);        
            
            /*create a new account*/
            revrec = new Revenue_Recognition__c();
            
        }/*End Inner class Constructor*/    
    }/*End inner Class*/
}/*End Class*/

VF Code:
<apex:page StandardController="Revenue_Recognition__c" extensions="revRecMultiadd" id="thePage">
<apex:form >
<apex:pageblock id="pb" >
    <apex:pageBlockButtons >
        <apex:commandbutton value="Add" action="{!Add}" rerender="pb1"/>
        <apex:commandbutton value="Save" action="{!Save}"/>
    </apex:pageBlockButtons>
    
        
        <apex:pageblock id="pb1">
            
        <apex:repeat value="{!lstInner}" var="e1" id="therepeat">
                <apex:panelGrid columns="5">
                
                <apex:panelGrid headerClass="Name">
                    <apex:facet name="header">Del</apex:facet>
                    <apex:commandButton value="X" action="{!Del}" rerender="pb1">
                        <apex:param name="rowToBeDeleted" value="{!e1.recCount}" assignTo="{!selectedRowIndex}"></apex:param>
                    </apex:commandButton>
                </apex:panelGrid>   
                
                <apex:panelGrid title="SPD" >
                    <apex:facet name="header">Duration</apex:facet>
                    <apex:inputfield value="{!Revenue_Recognition__c.Duration__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Start Date</apex:facet>
                    <apex:inputfield value="{!Revenue_Recognition__c.Start_Date_Delivery_Date__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Name</apex:facet>
                    <apex:inputfield value="{!Revenue_Recognition__c.Name}"/>
                </apex:panelGrid>
            </apex:panelgrid>
        </apex:repeat>
    </apex:pageBlock>
        
</apex:pageblock>
</apex:form>
</apex:page>

Any help is highly apprecitated!! 

Thanks so much,
Heather
Hi all,
I am learning Visualforce and I am trying to add some VF code to a Custom Object, but I keep getting this error when I try to save:

Error: Unknown property 'Revenue_Recognition__cStandardController.revenue_recognition'

Controller:
public class revRecExtension
{
    ApexPages.StandardController stdCtrl;
    public revRecExtension(ApexPages.StandardController std)
    {
       stdCtrl=std;
    }
 
    public PageReference save()
    {
        stdCtrl.save();
        return null;
    }
}

VF Code:
<apex:page standardController="Revenue_Recognition__c" extensions="revRecExtension">
<apex:sectionHeader title="Revenue Recognition"/>
<apex:form >
    <apex:pageBlock title="Edit" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Revenue Recognition Details" columns="2">
            <apex:inputField value="{!revenue_recognition.duration__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

Any help would be highly appreciated!!

Thanks!!
Heather
Hi all,
I am an SFDC Admin and am VERY new to the developer side of SFDC. I am currently trying to learn Apex Classes and Triggers. I was wondering if anyone could write my psudeo code for me with actual apex code and syntax? This would REALLY help me understand how to tranlate it. 

Thanks!!!!
Heather

Business need: Want to recognize revenue over time for Forecasting. Large deals are recognized by Quarter.

Technical need: To insert records on custom object "Revenue Recogntion" whenever specific fields on opportunity are populated.

If Opportunity fields Duration (picklist) is populated then records in Revenue Recognition custom object need to be inserted.

When new records are inserted, specific fields must be auto populated based on values populated in Opportunity:
Duration
Start Date

Example:

If Duration on Opportunity equals "3"
And Start Date equals 8/1/2015
And Amont equls "$60,000"
Then 3 records must be inserted in the Revenue Recognition custom object with the following fields auto populated:

Record 1:
Revenue: $20,000 (calculation is Amount / Duration)
Rev Rec Quarter: Q3 (Since August is in the third quarter)
Rev Rec Year: 2015 (copies the year from the Start Date)

Record 2:
Revenue: $20,000 (same calculation)
Rev Rec Quarter: Q4 (since 3 was chosen for number of quarters in Duration)
Rev Rec Year: 2015 (copies the year from the Start Date)

Record 3:
Revenue: $20,000 (same calculation)
Rev Rec Quarter: Q1
Rev Rec Year: 2016 (must be pushed out a year since after Q4)

Psudeo Code: 

Get AmtPerDuration

numDuration = Opp.Duration
Amount / numDuration
AmountPerDuration

Find Quarter and Year (Start Date)

If Start month == Jan, Feb, March
(Quarter = Q1)
Else If Start month == April, May, June
(Quarter = Q2)
Else If Start month == July, Aug, September
(Quarter = Q3)
Else If Start month == Oct, Nov, Dec
(Quarter = Q4)

If Quarter = after Q4
Year + 1

So I need this piece in a class, and then I need a trigger which will call this class... the trigger would be:

If Duration is not equal to null, then insert Rev Rec Records and Populate fields based on Duration (quarters) and Start Date.

Really ANY help on this would be SO helpful!! I really want to learn how to do this... and I really understand the above concept as I came up with it... so seeing this put into code will really help me understand the syntax of it.

Thanks so much for any help provided!!
Heather

 
Hi all,

I need to embed my VF Custom Object into my Opportunity Page Layout, but not sure how to accomplish this. I know that the standardController points to the Custom Object, but how do I create a relationship with the Opportunity so that I am able to add it to the Opp Page Layouts? Below is my Controller and VF Code:

Controller: 
public class revRecMultiadd
{
    
    //will hold the rev rec records to be saved
    public List<Revenue_Recognition__c>lstRevRec  = new List<Revenue_Recognition__c>();
    
    //list of the inner class
    public List<innerClass> lstInner 
    {   get;set;    }
    
    //will indicate the row to be deleted
    public String selectedRowIndex
    {get;set;}  
    
    //no. of rows added/records in the inner class list
    public Integer count = 1;
    //{get;set;}
    
    
    ////save the records by adding the elements in the inner class list to lstAcct,return to the same page
    public PageReference Save()
    {
        PageReference pr = new PageReference('/apex/revRecMultiadd');
        
        for(Integer j = 0;j<lstInner.size();j++)
        {
            lstRevRec.add(lstInner[j].revrec);
        } 
        insert lstRevRec;
        pr.setRedirect(True);
        return pr;
    }
        
    //add one more row
    public void Add()
    {   
        count = count+1;
        addMore();      
    }
    
    /*Begin addMore*/
    public void addMore()
    {
        //call to the iner class constructor
        innerClass objInnerClass = new innerClass(count);
        
        //add the record to the inner class list
        lstInner.add(objInnerClass);    
        system.debug('lstInner---->'+lstInner);            
    }/* end addMore*/
    
    /* begin delete */
    public void Del()
    {
        system.debug('selected row index---->'+selectedRowIndex);
        lstInner.remove(Integer.valueOf(selectedRowIndex)-1);
        count = count - 1;
        
    }/*End del*/
    
    
    
    /*Constructor*/
    public revRecMultiadd(ApexPages.StandardController ctlr)
    {
    
        lstInner = new List<innerClass>();
        addMore();
        selectedRowIndex = '0';
        
    }/*End Constructor*/
        


    /*Inner Class*/
    public class innerClass
    {       
        /*recCount acts as a index for a row. This will be helpful to identify the row to be deleted */
        public String recCount
        {get;set;}
        
        
        public Revenue_Recognition__c revrec
        {get;set;}
        
        /*Inner Class Constructor*/
        public innerClass(Integer intCount)
        {
            recCount = String.valueOf(intCount);        
            
            /*create a new account*/
            revrec = new Revenue_Recognition__c();
            
        }/*End Inner class Constructor*/    
    }/*End inner Class*/
}/*End Class*/

VF Code:
<apex:page StandardController="Revenue_Recognition__c" extensions="revRecMultiadd" id="thePage">
<apex:form >
<apex:pageblock id="pb" >
    <apex:pageBlockButtons >
        <apex:commandbutton value="Add" action="{!Add}" rerender="pb1"/>
        <apex:commandbutton value="Save" action="{!Save}"/>
    </apex:pageBlockButtons>
    
        
        <apex:pageblock id="pb1">
            
        <apex:repeat value="{!lstInner}" var="e1" id="therepeat">
                <apex:panelGrid columns="5">
                
                <apex:panelGrid headerClass="Name">
                    <apex:facet name="header">Del</apex:facet>
                    <apex:commandButton value="X" action="{!Del}" rerender="pb1">
                        <apex:param name="rowToBeDeleted" value="{!e1.recCount}" assignTo="{!selectedRowIndex}"></apex:param>
                    </apex:commandButton>
                </apex:panelGrid>   
                
                <apex:panelGrid title="SPD" >
                    <apex:facet name="header">Duration</apex:facet>
                    <apex:inputfield value="{!Revenue_Recognition__c.Duration__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Start Date</apex:facet>
                    <apex:inputfield value="{!Revenue_Recognition__c.Start_Date_Delivery_Date__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Name</apex:facet>
                    <apex:inputfield value="{!Revenue_Recognition__c.Name}"/>
                </apex:panelGrid>
            </apex:panelgrid>
        </apex:repeat>
    </apex:pageBlock>
        
</apex:pageblock>
</apex:form>
</apex:page>

Any help is highly apprecitated!! 

Thanks so much,
Heather
Hi all,
I am learning Visualforce and I am trying to add some VF code to a Custom Object, but I keep getting this error when I try to save:

Error: Unknown property 'Revenue_Recognition__cStandardController.revenue_recognition'

Controller:
public class revRecExtension
{
    ApexPages.StandardController stdCtrl;
    public revRecExtension(ApexPages.StandardController std)
    {
       stdCtrl=std;
    }
 
    public PageReference save()
    {
        stdCtrl.save();
        return null;
    }
}

VF Code:
<apex:page standardController="Revenue_Recognition__c" extensions="revRecExtension">
<apex:sectionHeader title="Revenue Recognition"/>
<apex:form >
    <apex:pageBlock title="Edit" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Revenue Recognition Details" columns="2">
            <apex:inputField value="{!revenue_recognition.duration__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

Any help would be highly appreciated!!

Thanks!!
Heather
Hi all,
I am an SFDC Admin and am VERY new to the developer side of SFDC. I am currently trying to learn Apex Classes and Triggers. I was wondering if anyone could write my psudeo code for me with actual apex code and syntax? This would REALLY help me understand how to tranlate it. 

Thanks!!!!
Heather

Business need: Want to recognize revenue over time for Forecasting. Large deals are recognized by Quarter.

Technical need: To insert records on custom object "Revenue Recogntion" whenever specific fields on opportunity are populated.

If Opportunity fields Duration (picklist) is populated then records in Revenue Recognition custom object need to be inserted.

When new records are inserted, specific fields must be auto populated based on values populated in Opportunity:
Duration
Start Date

Example:

If Duration on Opportunity equals "3"
And Start Date equals 8/1/2015
And Amont equls "$60,000"
Then 3 records must be inserted in the Revenue Recognition custom object with the following fields auto populated:

Record 1:
Revenue: $20,000 (calculation is Amount / Duration)
Rev Rec Quarter: Q3 (Since August is in the third quarter)
Rev Rec Year: 2015 (copies the year from the Start Date)

Record 2:
Revenue: $20,000 (same calculation)
Rev Rec Quarter: Q4 (since 3 was chosen for number of quarters in Duration)
Rev Rec Year: 2015 (copies the year from the Start Date)

Record 3:
Revenue: $20,000 (same calculation)
Rev Rec Quarter: Q1
Rev Rec Year: 2016 (must be pushed out a year since after Q4)

Psudeo Code: 

Get AmtPerDuration

numDuration = Opp.Duration
Amount / numDuration
AmountPerDuration

Find Quarter and Year (Start Date)

If Start month == Jan, Feb, March
(Quarter = Q1)
Else If Start month == April, May, June
(Quarter = Q2)
Else If Start month == July, Aug, September
(Quarter = Q3)
Else If Start month == Oct, Nov, Dec
(Quarter = Q4)

If Quarter = after Q4
Year + 1

So I need this piece in a class, and then I need a trigger which will call this class... the trigger would be:

If Duration is not equal to null, then insert Rev Rec Records and Populate fields based on Duration (quarters) and Start Date.

Really ANY help on this would be SO helpful!! I really want to learn how to do this... and I really understand the above concept as I came up with it... so seeing this put into code will really help me understand the syntax of it.

Thanks so much for any help provided!!
Heather