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
sunayasunaya 

Searching the Product2 Table via custom visualforce page using WSDL file related to ZUORA

This was developed by one of the freelance developer, and I am trying to understand how to enhance the search results. Any ideas or tips would be appreciated?

 

Here is the situation:-

 

We have 30,000 product line items in the Product2 table. If we search for any part number (custom field in product2 table) the search results efficient are accurate.

If the same table is searched via a VisualForce page which is being called in the APEX Class, the search is SUPER DUPER Slow.

 

The APEX Class is as follows:-

Please advice, what is the better way to write this APEX Class, so the search results can be made faster:-

 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 global class AddProductLines {
      webservice static String doNothing(String QuoteHeaderID) {
          String ProductQuoteID;
          List<Quote> ProductQuoteHeader = [SELECT ID FROM Quote WHERE QuoteCommonHeader__c =: QuoteHeaderID LIMIT 1];
          For(Quote q : ProductQuoteHeader){
              ProductQuoteID = q.ID;
          }
          string CurrURL = URL.getCurrentRequestUrl().toExternalForm();
        system.debug('CurrentURL :' + CurrURL);
        String[] CurrURLsplit = CurrURL.Split('/');
        String LongServer = CurrURLsplit[2];
          system.debug('LongServer :' + LongServer);
        string LongServerReplace = LongServer.Replace('.','/');
        String[] LongServerSplit = LongServerReplace.Split('/');
        string server = LongServerSplit[0];      
         //https://cs13.salesforce.com/_ui/sales/quote/SelectSearch?addTo=0Q0W00000004GQJ&retURL=%2F0Q0W00000004GQJ
          string urlPreamble = 'https://c.' + server + '.visual.force.com/apex/CustomProductSelector?';
          string urlMidSection = '&retURL=%2F';
          string NewURL =  urlPreamble + 'MQ=' + QuoteHeaderID + '&PQ=' + ProductQuoteID ; // + ProductQuoteID + urlMidsection + QuoteHeaderID; //ProductQuoteID;
         
          PageReference ProductAddPage = new PageReference(NewURL);
          ProductAddPage.setRedirect(true);
        //    return 'NewURL';
      
      Return NewURL;
       }
}

 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

Here is the VF page. It is very long, so I will just paste the heading of it.

 

 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

<apex:page StandardController="PricebookEntry" Extensions="ProductSelectorExtension" standardStylesheets="True" id="MainPage" sidebar="false">

 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

 

 

Thanks

sumita