+ Start a Discussion
SFDC@ErrorSFDC@Error 

VF Page not working In Production

HI All

I am confusing why VF PAge not working in Production which is working fine in sandbox .In Sandbox its showing all list which is not showing Pro.User-added image
User-added image
 
<apex:page standardController="Quotation_Line_Item__c" extensions="ctrl_addproduct" showHeader="true" sidebar="false">
<apex:slds /> 
<div class="slds-scope">
<apex:form >


        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <script>
            $(document).ready(function() {
                $("input:checkbox").click(function() {
                    var decision = $(this).prop("checked")
                    var group = "input:checkbox[class='" + $(this).attr("class") + "']";
                    var n = group.indexOf("Common");
                    if (n >= 0) {} else {
                        if (decision) {
                            $(group).prop("checked", false);
                            $(this).prop("checked", true);
                        }
                    }
                });

            });
        </script>
        
    
        <apex:pageMessages />
        
       
        
       <apex:pageBlock mode="Edit">
        <div style="text-align:right;">

            <apex:pageBlockButtons >
            <apex:inputText value="{!searchstring}" label="Input"/>   
  <apex:commandButton value="SEARCH PRODUCT" action="{!search}" styleClass="slds-button slds-button_success"/> 
                <apex:commandButton value="ADD PRODUCT" action="{!Csave}" styleClass="slds-button slds-button_success"/>
                <apex:commandButton value="CANCEL" action="{!Cancel}" styleClass="slds-button slds-button_destructive"/>
            </apex:pageBlockButtons>
            </div> 
            
            
         
             
               
                
                <apex:pageBlockTable value="{!pitem}" var="pi">
                    <apex:column headerValue="Select" headerClass="slds-text-title--caps">
                        <apex:inputField value="{!pi.Applicable__c}" />
                    </apex:column>
                    <apex:column value="{!pi.Name}" headerClass="slds-text-title--caps" />   
                     <apex:column headerValue="Basic Unit Price" headerClass="slds-text-title--caps">
                        <apex:outputField value="{!pi.Basic_Unit_Price__c}" />
                    </apex:column>
                     <apex:column headerValue="Size" headerClass="slds-text-title--caps">
                        <apex:inputField value="{!pi.Size__c}" />
                    </apex:column>
                    <apex:column headerValue="Quantity" headerClass="slds-text-title--caps">
                        <apex:inputField value="{!pi.Quantity__c}" />
                    </apex:column>
                    
                     
                </apex:pageBlockTable>
           
        </apex:pageBlock>
       
        </apex:form>
        </div>
        </apex:page>
--------------------------------------------------
Public with sharing class ctrl_addproduct{

   
     public List<Product__c> pitem{get;set;} 
     public List<Quotation_Line_Item__c> qitem{get;set;}
     public List<Quote_Product_Line_Item__c> opitem{get;set;}   
     public ID oppid {get; set;}
     public string searchstring {get;set;}  
     public boolean refpage{get;set;}
     
     public string searchText {get;set;}
     public String message {get;set;}
     
     public ctrl_addproduct(ApexPages.StandardController controller){
         pitem = new List<Product__c>();
         qitem = new List<Quotation_Line_Item__c>();
         opitem = new List<Quote_Product_Line_Item__c>();
         oppid = ApexPages.currentPage().getParameters().get('qid');
         
         pitem = [SELECT Applicable__c,Quantity__c,Account_Name__c, Basic_Unit_Price__c, CreatedById, CreatedDate, IsDeleted, Description__c, LastActivityDate, LastModifiedById, LastModifiedDate, 
         OwnerId, Name, Id, RecordTypeId, Size__c, Category__C, SystemModstamp,Type__c, Discount__c FROM Product__c where RecordTypeId=:'0120l0000000gGxAAI'];
         
         qitem = [SELECT id,Name FROM Quotation_Line_Item__c];
         refpage=false;
     }
     
     public void search(){  
     string searchquery='select name,id,Applicable__c,Quantity__c,Account_Name__c,size__c, Basic_Unit_Price__c from Product__c where name like \'%'+searchstring+'%\' Limit 20';  
     pitem = Database.query(searchquery);  
   }  
     
     
     
    
    Public  PageReference csave()
    {
       oppid = ApexPages.currentPage().getParameters().get('Id');
       try 
       {  
           system.debug('***'+oppid);
          for(Product__c op:pitem)
          {
              Quote_Product_Line_Item__c p = new Quote_Product_Line_Item__c();
              if(op.Applicable__c==TRUE)
              {     
                  system.debug('&&'+op);
                   p.Basic_Unit_Price__c=op.Basic_Unit_Price__c;
                   p.Quotation_Line_Item__c =oppid;
                   p.Product__c =op.id;
                   p.Quantity__c =op.Quantity__c; 
                   p.Size__c =op.Size__c;
                   p.Type__c =op.Category__C;
                   p.Discount__c =op.Discount__c;
                   p.Name=op.Name;opitem.add(p);
              
              }
            
          }
           system.debug('&&&&'+oppid);
           Insert opitem; message = 'updated records Sucessfully';
           
           
        } 
        Catch (Exception e) 
        {
            ApexPages.addMessages(e);
            return null;
        }
        
        PageReference nextpage= new PageReference('/'+oppid);
        //return new PageReference('javascript:self.close()');
        nextpage.setRedirect(true);
        return nextpage;
   }
   public PageReference cancel() 
   {
    oppid = ApexPages.currentPage().getParameters().get('Id');
     PageReference returnPage = new PageReference('/'+oppid);
     returnPage.setRedirect(True);  
     return returnPage;
   }
}

 
GulshanRajGulshanRaj
Here are some points:
  • Please check if records are actually accessible to user, since class is declared "with sharing".
  • Please check what data is coming inside ctrl_addproduct by applying debug log.

Thanks & Regards
Gulshan Raj
Sr. Developer

User-added image
SFDC@ErrorSFDC@Error
Yes Raj ,I have tested .Problem is when i am using in sandbox it is ok and its displaying all record without search .but in production it is not showing all record by-default and showing once i will search record .