function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhijeet Purohit01Abhijeet Purohit01 

Problem with visual force component's APEX class.

Please can anyone tell me what mistake am doing here? It is not querying any values from the database. It is working without errors but daata is not querying. Kindly help pls.

 

global class OrderStatusComponentClass{

      

    Id accId;

    global String name {get;set;}

   

    global List<Sales_Order__c> pendingorder { get;set;}

    global List<Sales_Order__c> pending1 {get;set;}

    global List<Sales_Order__c> recentDespatch { get; set;}

    global List<Sales_Order__c> despatch1 { get; set;}

   

    private final Account account;

    public OrderStatusComponentClass(){

      try{

        account = [select Name,id, (SELECT Contact.Name, Contact.Email FROM Account.Contacts where Contact.Email != null  AND Credit_Report__c LIKE 'Yes' )  from Account where id = :ApexPages.currentPage().getParameters().get('id')];

        system.debug('try block:'+account);

      }

      catch(Exception e){

        System.debug('error sending mail'+e);

      }

    }

   

   

     // querying data for component

   public pageReference querySO1(){

   

     System.debug('Control enters VisualForce Component code block');

     pendingOrder = new List<Sales_Order__c>();

     recentDespatch = new List<Sales_Order__c>();

     pending1 = new List<Sales_Order__c>();

     despatch1 = new List<Sales_Order__c>();

     accId = ApexPages.currentPage().getParameters().get('id');

     System.debug('Account ID'+accId);

   

     Account acc1 = new Account();

     acc1 = [SELECT Name FROM Account WHERE id=: accId];

     name = acc1.Name;

   

     pendingOrder = [ select PO_No__c, Balance_Quantity__c, Product_Description__c, Sales_Order_Status__c, Current_Despatch_Date_2__c from Sales_Order__c WHERE Account_Name__c =: accId AND (Sales_Order_Status__c != 'Closed') ORDER BY Current_Despatch_Date_2__c ];

   

  System.debug('Queried from Pending Order visual component:'+pendingorder);

   

 for( Sales_Order__c so1 : pendingOrder ){

       pending1.add(so1);

       system.debug('Pending1:'+pending1);

     }

    

recentDespatch = [select  PO_No__c, Invoice__r.Name, Quote_Quantity__c, Invoiced_Quantity__c, PO_Quantity__c, Product_Description__c, Tentative_Despatch_Date__c, Sales_Order_Status__c  FROM Sales_Order__c WHERE Account_Name__c =: accId AND Actual_Despatch_Date_Time__c != Null AND (Sales_Order_Status__c LIKE 'Closed') ORDER BY Tentative_Despatch_Date__c asc limit 10 ];

 

 System.debug('Queried from Recent Despatch visual force component:'+recentDespatch); 

 for( Sales_Order__c so2 : recentDespatch ){

     despatch1.add(so2);

      system.debug('Despatch1:'+despatch1);

     } 

     return null;

  } 

 }