• Meeta Khullar 5
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
I'm doing the trial "Create a Satisfaction Survey" on step 5 I'm getting error 

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: UZUPNFMU
I have a 2 VF page, one is used to create the output based on the input that is provided by the user and the other one is to create the csv file. I have date field as the output. The problem that I'm having is the csv output looks something like this for the date field "Thu Jan 01 00:00:00 GMT 2015". I want it in the mm/dd/yyyy format. How can I do this, here is the code for the VF for creating the csv file

apex:page controller="RMSControllerTest"  contentType="application/vnd.ms-excel#ConsignmentSearchData.csv" cache="true" >Invoice Number,Invoice Line Name,Product Name, Product Line, Start Date, End Date, Recognized Revenue, Deferred Revenue, Total Amount, QAD Domian, Created Date
    <apex:repeat value="{!invoiceLines}" var="item">
        {!item.invoiceLine.invoice__r.name},{!item.invoiceLine.name},{!item.invoiceLine.Start_Date__c},{!item.invoiceLine.End_Date__c},{!item.recognizedRevenue},{!item.deferredRevenue},{!item.totalAmount},{!item.invoiceLine.CreatedDate}
    </apex:repeat>
   
</apex:page>

      
I have 2 visualforce page with the same controller. One is used for the user to input the data to get the output accordingly. The other one is built to generate the csv file for the output of the first visualforce page. The problem that I'm having is the input parameter that is provided in the first page is not passing onto the second visualforce page. Because of which the csv file is exporting all the data from the database and not filtering based on the input of the user. How can I pass the input parameter into the second page.

Here is the input that is passed in the first VF page


 <apex:page controller="RMSControllerTest"  title="Physico" docType="html-5.0" showHeader="true"  cache="true">

 <apex:form >
 
    <apex:pageBlock title="Revenue Recognition test">
           <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            
            <apex:facet name="header">
                <span style="color:black">Enter Search Details</span>
            </apex:facet>
        
            <apex:outputlabel value="From:"/>
               <apex:input type="date" value="{!startDate}" size="10" id="StartDate" onfocus="DatePicker.pickDate(false, this , false);" />
            </apex:pageBlockSectionItem>  
            
            <apex:pageBlockSectionItem >
                <apex:outputlabel value="To:"/>
               <apex:input type="date" value="{!endDate}" size="10" id="Enddate" onfocus="DatePicker.pickDate(false, this , false);" />          
               <!--<apex:input value="{!endDate}" size="10" id="EndDate" onfocus="DatePicker.pickDate(false, this , false);" /> -->
            </apex:pageBlockSectionItem>
            
             <apex:inputText id="ordernumber" title="Order No." value="{!orderNumber}" label="Order No." />
           
             <apex:inputText id="invoiceNumber" title="Invoice no" value="{!InvoiceNo}" label="Invoice No."/>


Here is the controller and the coding to call the next VF Page when the user click "EXPORT TO CSV"

public PageReference Import() {
    
      PageReference logPage = New PageReference('/apex/RevenueRecognizedTestExport?sfdc.tabName=06655000000DFAA');
      
      logPage.setRedirect(true);
      return logpage;
    }


Here is the other VF PAge that is generating CSV file

<apex:page controller="RMSControllerTest"  contentType="application/vnd.ms-excel#ConsignmentSearchData.csv" cache="true" >
    Invoice Number,Invoice Line Name,Product Name, Product Line, Start Date, End Date, Recognized Revenue, Deferred Revenue, Total Amount, QAD Domian, Created Date
    <apex:repeat value="{!invoiceLines}" var="item">
        {!item.invoiceLine.invoice__r.name},{!item.invoiceLine.name},{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.name},{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.Product_Line__c},{!item.invoiceLine.Start_Date__c},{!item.invoiceLine.End_Date__c},{!item.recognizedRevenue},{!item.deferredRevenue},{!item.totalAmount},{!item.invoiceLine.Order_Product__r.order.account.QAD_Domain__c},{!item.invoiceLine.CreatedDate}
    </apex:repeat>
I'm new to export csv functionality on Visualforce page. We have a command button on the visualforce page that is suppose to export the output of the page. There is no coding for this button. I need help in building this functionality. Here are the code for the VF page as well as the controller
VF Page
<apex:page controller="RMSControllerTest" title="Physico" docType="html-5.0" showHeader="true" >

 <apex:form >
 
    <apex:pageBlock title="Revenue Recognition test">
           <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
           
            <apex:facet name="header">
                <span style="color:black">Enter Search Details</span>
            </apex:facet>
       
            <apex:outputlabel value="From:"/>
               <apex:input type="date" value="{!startDate}" size="10" id="StartDate" onfocus="DatePicker.pickDate(false, this , false);" />
            </apex:pageBlockSectionItem> 
           
            <apex:pageBlockSectionItem >
                <apex:outputlabel value="To:"/>
               <apex:input type="date" value="{!endDate}" size="10" id="Enddate" onfocus="DatePicker.pickDate(false, this , false);" />         
               <!--<apex:input value="{!endDate}" size="10" id="EndDate" onfocus="DatePicker.pickDate(false, this , false);" /> -->
            </apex:pageBlockSectionItem>
           
             <apex:inputText id="ordernumber" title="Order No." value="{!orderNumber}" label="Order No." />
          
             <apex:inputText id="invoiceNumber" title="Invoice no" value="{!InvoiceNo}" label="Invoice No."/>
          
             <apex:pageBlockSectionItem >
                 <apex:outputLabel value="QAD Domain"/>
                 <apex:inputField id="QADDomain" value="{!ord.account.QAD_Domain__c}">
                       <apex:actionSupport event="onchange" rendered="false">                            
                           <apex:param name="domainName" value="{!ord.account.QAD_Domain__c}" assignTo="{!domain}"/> 
                         </apex:actionSupport>
                 </apex:inputField>
           </apex:pageBlockSectionItem>
                     
          
            <apex:pageBlockSectionItem >
                 <apex:outputLabel value="Account" for="theLookup"/>
                 <apex:inputField id="Account" value="{!ord.accountid}" label="Account">
                     <apex:actionSupport event="onchange" rendered="false">                            
                           <apex:param name="accountId" value="" assignTo="{!accountId}"/> 
                     </apex:actionSupport>
                 </apex:inputField>
             </apex:pageBlockSectionItem>
             
          </apex:pageBlockSection>
         
         <apex:pageBlockButtons location="bottom" >
            <apex:commandButton id="searchBtn" action="{!searchResults}" value="Search" style="text-align:center;align:center;" />
            <apex:commandButton action="{!cancel}" value="Cancel" style="text-align:left"/>
            <apex:commandButton action="{!Import}" value="Export to csv" style="text-align:left"/>
         </apex:pageBlockButtons>
        </apex:pageBlock>
       
    <apex:pageblock id="RMSData">    
   
        <apex:pageblocktable value="{!invoiceLines}"  var="item" rendered="{!renderSearch}">
       
           <apex:column headervalue="Invoice Number">
               <apex:outputLink value="/{!item.invoiceLine.invoice__r.id}" target="_parent">{!item.invoiceLine.invoice__r.name} </apex:outputLink>
            </apex:column>
           
            <apex:column headervalue="Invoice Line Name">
                <apex:outputLink value="/{!item.invoiceLine.id}" target="_parent">{!item.invoiceLine.Name}</apex:outputLink>
            </apex:column>
           
            <apex:column headervalue="Product Name">
                <apex:outputLink value="/{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.id}" target="_parent">{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.name}</apex:outputLink>
            </apex:column>
           
             <apex:column headervalue="Product Line">
                <apex:outputtext value="{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.Product_Line__c}"/>
            </apex:column>           
          
           
            <apex:column headervalue="Start Date">
              <apex:outputtext value="{0,date,MM'/'dd'/'yyyy}">
                    <apex:param value="{!item.invoiceLine.Start_Date__c}"/>
                    </apex:outputtext>
             </apex:column>
           
             <apex:column headervalue="End Date">
                    <apex:outputtext value="{0,date,MM'/'dd'/'yyyy}">
                    <apex:param value="{!item.invoiceLine.End_Date__c}"/>
                    </apex:outputtext>
            </apex:column>
           
             <apex:column headervalue="Recognized Revenue">
                <apex:outputtext value="{!item.recognizedRevenue}"/>
            </apex:column>
           
            <apex:column headervalue="Deferred Revenue">
                 <apex:outputtext value="{!item.deferredRevenue}"/>
            </apex:column>
           
            <apex:column headervalue="Total Amount">
                 <apex:outputtext value="{!item.totalAmount}"/>
            </apex:column>
           
             <apex:column headervalue="QAD Domian">
                 <apex:outputtext value="{!item.invoiceLine.Order_Product__r.order.account.QAD_Domain__c}"/>
            </apex:column>
           
                       
        </apex:pageblocktable>
    </apex:pageblock>
     <script type="text/javascript">
      function validateSearchCriteria(field){
         var ordernumber = document.getElementById(field).value;
          var isIntegerRegex = /^\s*(\+|-)?\d+\s*$/;
         if(String(ordernumber).search(isIntegerRegex) == -1){
            alert('please enter valid order number');
         }
         return true;
      }
    </script>
  </apex:form>  
</apex:page>


Controller

public with sharing class RMSControllerTest {
    public Date startDate {get; set;}
    public Date endDate {get; set;}
    public boolean renderSearch = false;
    public string  orderNumber{get;set;}
    public string  InvoiceNo {get;set;}
    public String  domain {get;set;}
    public String accountId { get;  set; }
    public Order ord { get; set; }
       
    public RMSControllerTest(ApexPages.StandardController controller) {
        this.startDate = startDate;
        this.endDate   = endDate;   
        this.accountId = accountId;
        this.OrderNumber= OrderNumber;
        this.domain = domain;
        this.InvoiceNo = InvoiceNo;
    }
   
    public void setRenderSearch(boolean renderSearch){
      this.renderSearch = renderSearch;
    }
   
    public boolean getRenderSearch(){
       return renderSearch;
    }
  
    public RMSControllerTest() {
          
    }
   
    public void searchResults(){
        renderSearch = true;
    }

With more coding to get the data. Here is the code on how csv is being exported  

public PageReference Import() {
      PageReference logPage = New PageReference('/apex/RevenueRecognizedTest?sfdc.tabName=01r550000000MXh');
      logPage.setRedirect(true);
      return logpage;

 
I have a visualforce page that has a picklist field "QAD Domain". This is the coding to display the field

<apex:pageBlockSectionItem >
                 <apex:outputLabel value="QAD Domain"/>
                 <apex:inputField id="QADDomain" value="{!ord.account.QAD_Domain__c}">
                       <apex:actionSupport event="onchange" rendered="false">                             
                              <apex:param name=" {!domain} " value="{!ord.account.QAD_Domain__c}" assignTo="{!domain}"/> 
                       </apex:actionSupport>
                 </apex:inputField>
           </apex:pageBlockSectionItem>   



I have a controller that does the get and set method. When I run the debug log I see there is no value that is passed to the controller for the domain. Can someone point me what correction I need to make to the code in order to get the selected value in the controller.

public String  domain {get;set;}
if(domain != null)
                  mainSoql = mainSoql + ' and  Order_Product__r.order.account.QAD_Domain__c = \''+ domain + '\'';

String mainSoql = 'select id,'+
                    'Name,'+
                   'Start_Date__c,'+
                    'End_Date__c,'+
                    'Order_Product__r.UnitPrice,'+            
                    'Order_Product__r.id,'+
                    'Order_Product__r.order.account.QAD_Domain__c,'+
                    'Order_Product__r.order.accountid,'+
                    'Invoice__r.Orders__r.Name'+
                    ' from Invoice_Line_Items__c where Invoice__r.Status__c= \''+
                    invoiceStatus+'\' and  Unit_Price__c > 0';

 
I have a visual force page that is build to do revenue recognition using custom object invoice and start object order. The form has an Account field that the user can look up the revenue based on the account. The problem that I'm having is that when the user put in the account that has 0 order the VF page throws 'System.QueryException' exception. I'm trying to use the try catch but it is still failing. Here is the code snip, the row that is highlighted in bold and underlined is the one that is causing the issue. Please suggest how do I resolve this issue.

public with sharing class RMSController{
    // public List<Order> ord1 = new List<Order>();
    public Date startDate {get; set;}
    public Date endDate {get; set;}
    public boolean renderSearch = false;
    public string  orderNumber{get;set;}
    public string  InvoiceNo {get;set;}
    public String  domain {get;set;}
    public String accountId { get;  set; }
    public Order ord {  set; }
    
    
   public Order getOrd(){
        if(accountId!= null) 
              return [select id,account.id,account.QAD_Domain__c from order where account.id = : accountId limit 1]; 
              return null; 
   } 
I have 2 visualforce page with the same controller. One is used for the user to input the data to get the output accordingly. The other one is built to generate the csv file for the output of the first visualforce page. The problem that I'm having is the input parameter that is provided in the first page is not passing onto the second visualforce page. Because of which the csv file is exporting all the data from the database and not filtering based on the input of the user. How can I pass the input parameter into the second page.

Here is the input that is passed in the first VF page


 <apex:page controller="RMSControllerTest"  title="Physico" docType="html-5.0" showHeader="true"  cache="true">

 <apex:form >
 
    <apex:pageBlock title="Revenue Recognition test">
           <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            
            <apex:facet name="header">
                <span style="color:black">Enter Search Details</span>
            </apex:facet>
        
            <apex:outputlabel value="From:"/>
               <apex:input type="date" value="{!startDate}" size="10" id="StartDate" onfocus="DatePicker.pickDate(false, this , false);" />
            </apex:pageBlockSectionItem>  
            
            <apex:pageBlockSectionItem >
                <apex:outputlabel value="To:"/>
               <apex:input type="date" value="{!endDate}" size="10" id="Enddate" onfocus="DatePicker.pickDate(false, this , false);" />          
               <!--<apex:input value="{!endDate}" size="10" id="EndDate" onfocus="DatePicker.pickDate(false, this , false);" /> -->
            </apex:pageBlockSectionItem>
            
             <apex:inputText id="ordernumber" title="Order No." value="{!orderNumber}" label="Order No." />
           
             <apex:inputText id="invoiceNumber" title="Invoice no" value="{!InvoiceNo}" label="Invoice No."/>


Here is the controller and the coding to call the next VF Page when the user click "EXPORT TO CSV"

public PageReference Import() {
    
      PageReference logPage = New PageReference('/apex/RevenueRecognizedTestExport?sfdc.tabName=06655000000DFAA');
      
      logPage.setRedirect(true);
      return logpage;
    }


Here is the other VF PAge that is generating CSV file

<apex:page controller="RMSControllerTest"  contentType="application/vnd.ms-excel#ConsignmentSearchData.csv" cache="true" >
    Invoice Number,Invoice Line Name,Product Name, Product Line, Start Date, End Date, Recognized Revenue, Deferred Revenue, Total Amount, QAD Domian, Created Date
    <apex:repeat value="{!invoiceLines}" var="item">
        {!item.invoiceLine.invoice__r.name},{!item.invoiceLine.name},{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.name},{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.Product_Line__c},{!item.invoiceLine.Start_Date__c},{!item.invoiceLine.End_Date__c},{!item.recognizedRevenue},{!item.deferredRevenue},{!item.totalAmount},{!item.invoiceLine.Order_Product__r.order.account.QAD_Domain__c},{!item.invoiceLine.CreatedDate}
    </apex:repeat>
I have a visualforce page that has a picklist field "QAD Domain". This is the coding to display the field

<apex:pageBlockSectionItem >
                 <apex:outputLabel value="QAD Domain"/>
                 <apex:inputField id="QADDomain" value="{!ord.account.QAD_Domain__c}">
                       <apex:actionSupport event="onchange" rendered="false">                             
                              <apex:param name=" {!domain} " value="{!ord.account.QAD_Domain__c}" assignTo="{!domain}"/> 
                       </apex:actionSupport>
                 </apex:inputField>
           </apex:pageBlockSectionItem>   



I have a controller that does the get and set method. When I run the debug log I see there is no value that is passed to the controller for the domain. Can someone point me what correction I need to make to the code in order to get the selected value in the controller.

public String  domain {get;set;}
if(domain != null)
                  mainSoql = mainSoql + ' and  Order_Product__r.order.account.QAD_Domain__c = \''+ domain + '\'';

String mainSoql = 'select id,'+
                    'Name,'+
                   'Start_Date__c,'+
                    'End_Date__c,'+
                    'Order_Product__r.UnitPrice,'+            
                    'Order_Product__r.id,'+
                    'Order_Product__r.order.account.QAD_Domain__c,'+
                    'Order_Product__r.order.accountid,'+
                    'Invoice__r.Orders__r.Name'+
                    ' from Invoice_Line_Items__c where Invoice__r.Status__c= \''+
                    invoiceStatus+'\' and  Unit_Price__c > 0';

 
I have a visual force page that is build to do revenue recognition using custom object invoice and start object order. The form has an Account field that the user can look up the revenue based on the account. The problem that I'm having is that when the user put in the account that has 0 order the VF page throws 'System.QueryException' exception. I'm trying to use the try catch but it is still failing. Here is the code snip, the row that is highlighted in bold and underlined is the one that is causing the issue. Please suggest how do I resolve this issue.

public with sharing class RMSController{
    // public List<Order> ord1 = new List<Order>();
    public Date startDate {get; set;}
    public Date endDate {get; set;}
    public boolean renderSearch = false;
    public string  orderNumber{get;set;}
    public string  InvoiceNo {get;set;}
    public String  domain {get;set;}
    public String accountId { get;  set; }
    public Order ord {  set; }
    
    
   public Order getOrd(){
        if(accountId!= null) 
              return [select id,account.id,account.QAD_Domain__c from order where account.id = : accountId limit 1]; 
              return null; 
   }