• dev_002
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I friends, i'm very new to apex, somehow i managed to create a apex class to attach our custom quote (after some research on developer forum). But i'm unable to create a apex test class. I would very much appreciate if anyone could be able to help me out on this. 

Thank you very much
public class quoteExt {
    ApexPages.StandardController controller;
    public Quote q {get;set;}
    
    public quoteExt(ApexPages.StandardController controller) 
    {   
    controller = controller;
    q = (Quote) controller.getRecord();
    
     }
    
    public quoteExt(){}
    
    public PageReference attactQuote()
    {
    PageReference pdfPage = Page.quotationPDF;
    Blob pdfBlob = pdfPage.getContent();
    QuoteDocument a = new QuoteDocument (quoteid=q.id, Document=pdfBlob);
    insert a;
    
      PageReference detailPage = new PageReference('/../'+ q.id);
       detailPage.setRedirect(true);
       return detailPage;
    }
    static testmethod void basicAttachTest() {
        
         /* Construct the standard controller for quote. */
        ApexPages.StandardController con = new ApexPages.StandardController(new Quote());
        quoteExt ext = new quoteExt(con);
             
    
    }
}

 

Hi, I've been following developer forum for quite some time. The posts are have been very useful for me. 

 

I have been developing a visualforce page, replacing "new" opportunity button with a custome visualforce page. 

The issue we have encountered here is, other profile user are not able to access to the new visualforce page for opportunity. 

When the users click on the "new" button, the message is saying that the users are having insufficient priviledge to access to create a new opportunity. 

 

 

Blow is my code, which replaces the "new" button on opportunity.

------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

<apex:page standardController="Opportunity" sidebar="true" extensions="OppDefaultFieldVal"  >
    <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/>
    <apex:form >
          <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="edit">
             <apex:pageMessages />
            <apex:pageBlockButtons >
                 <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rendered="true"/>               
               </apex:pageBlockButtons>
            <apex:actionRegion >
                <apex:pageBlockSection title="Basic Information" columns="1">
                    <apex:outputField value="{!opportunity.recordtypeid}"/>
                    <apex:inputField value="{!opportunity.Salesperson__c}"/>
                    <apex:inputField value="{!opportunity.name}" />
                    <apex:inputField value="{!opportunity.closedate}"/>
                    <apex:inputField value="{!opportunity.StageName}"/>
                    <apex:inputField value="{!opportunity.accountid}"/>
                    <apex:inputField value="{!opportunity.Credit_Terms__c}" />
                    <apex:inputField value="{!opportunity.Description}"/>
                </apex:pageBlockSection>
            </apex:actionRegion>
          </apex:pageBlock>
    </apex:form>
</apex:page>
______________________________________________________________________________________________
I hope anyone could help me to solve this issue.
Thank You.

Hi, I've been following developer forum for quite some time. The posts are have been very useful for me. 

 

I have been developing a visualforce page, replacing "new" opportunity button with a custome visualforce page. 

The issue we have encountered here is, other profile user are not able to access to the new visualforce page for opportunity. 

When the users click on the "new" button, the message is saying that the users are having insufficient priviledge to access to create a new opportunity. 

 

 

Blow is my code, which replaces the "new" button on opportunity.

------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

<apex:page standardController="Opportunity" sidebar="true" extensions="OppDefaultFieldVal"  >
    <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/>
    <apex:form >
          <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="edit">
             <apex:pageMessages />
            <apex:pageBlockButtons >
                 <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rendered="true"/>               
               </apex:pageBlockButtons>
            <apex:actionRegion >
                <apex:pageBlockSection title="Basic Information" columns="1">
                    <apex:outputField value="{!opportunity.recordtypeid}"/>
                    <apex:inputField value="{!opportunity.Salesperson__c}"/>
                    <apex:inputField value="{!opportunity.name}" />
                    <apex:inputField value="{!opportunity.closedate}"/>
                    <apex:inputField value="{!opportunity.StageName}"/>
                    <apex:inputField value="{!opportunity.accountid}"/>
                    <apex:inputField value="{!opportunity.Credit_Terms__c}" />
                    <apex:inputField value="{!opportunity.Description}"/>
                </apex:pageBlockSection>
            </apex:actionRegion>
          </apex:pageBlock>
    </apex:form>
</apex:page>
______________________________________________________________________________________________
I hope anyone could help me to solve this issue.
Thank You.