• sachin_dreamoncloud
  • NEWBIE
  • 70 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
Hi All,

       In My org Opportunity Object Contains 20 Triggers. Each trigger contains 5 Queeries. Now I am trying to inserting the record.It shows the ERROR* like this " Too many SOQL Queries 101". The triggers all are fired and it reach the governer limit .So please help me how to resolve this situation.


Thanks&Regards
Hanu
here my requirments i want to display all reocrds in visualforce previous i was used offset but offset it will disply 2000 records, so now i am using standardsetconroller method
i wanna to cal the two methods will display records in pages, i am getting an error in visualforce error:rror is in expression '{!IF((pageNumber * size)>noOfRecords, noOfRecords,(pageNumber * size))}' in component <apex:outputText> in page transactionsearch
visulaforce page
=================
<apex:commandButton status="fetchStatus" reRender="pb" value="|<Frist" action="{!first}" disabled="{!!hasPrevious}" title="First Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Previous" action="{!previous}" disabled="{!!hasPrevious}" title="Previous Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Next" action="{!next}" disabled="{!!hasNext}" title="Next Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Last>|" action="{!last}" disabled="{!!hasNext}" title="Last Page"/>
                <apex:outputText >{!(pageNumber * size)+1-size}-{!IF((pageNumber * size)>noOfRecords, noOfRecords,(pageNumber * size))} of {!noOfRecords}</apex:outputText>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/>
              
                    <apex:actionStatus id="fetchStatus" startText="Please Wait..." stopText=""/>
           ==========================================controller==================================================================
Public class clsTransactionSearch
   {
        Public Integer noOfRecords{get; set;}
         Public Integer size{get;set;}
        //end of declation pagination//

  public ApexPages.StandardSetController setCon
     {
        get{
            if(setCon == null)
            {
               system.debug('start here$$$$$$$$$$$$$$$$$$$$');
                size = 10;
                  }
            return setCon;
        }set;
    }
     public pageReference refresh()
     {
        setCon = null;
      
        setCon.setPageNumber(1);
        return null;
    }
    public Boolean hasNext
    {
        get {
            return setCon.getHasNext();
        }
        set;
    }
    public Boolean hasPrevious
    {
        get {
            return setCon.getHasPrevious();
        }
        set;
    }
 
    public Integer pageNumber
    {
        get {
            return setCon.getPageNumber();
        }
        set;
    }
    public void Next()
    {
            setCon.Next();
            system.debug('next method');
             if(SearchText ==''|| SearchText=='null' )
               {
                     BindGridOnLoad();
               }
               else if(SearchText !='')
                {
                  
                   BindGrid();
         
                 }
        }       
   
   

      public List<Transaction__c> getRecords()
      {
      return (List<Transaction__c>)database.query(queryString+' LIMIT '+queryLimit+' OFFSET '+offset);
     
      }
   
    
   
    public void Previous()
    {
         setCon.previous();   
          
        if(SearchText ==''|| SearchText =='null' )
        {
        BindGridOnLoad();
      
        }
        else if(SearchText !='')
        {
        BindGrid();
        }
    }
   

   
   public void first()
    {
         setCon.first();
        if(SearchText ==''|| SearchText =='null' )
        {
        BindGridOnLoad();
      
        }
        else if(SearchText !='')
        {
        BindGrid();
        }
    }
   
    
   
    public void last()
    {
      
       setCon.last();
       if(SearchText ==''|| SearchText =='null' )
        {
        BindGridOnLoad();
      
        }
        else if(SearchText !='')
        {
        BindGrid();
        }
    }
public void BindGrid()
    { 
          SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn t.Target_Sector2__c LIKE :fsbo';
            List<Transaction__c> que = Database.query(SearchQuery);
            // listSize = que.size();
           //  system.debug('_______llllllllll__________'+listSize +offset+queryLimit);
                setCon = new ApexPages.StandardSetController(que);
                system.debug('**********searchquery*********'+setcon);
                setCon.setPageSize(size);
               
                noOfRecords = setCon.getResultSize();
                  
}

public void BindGridOnLoad()
      {
          res+='and ( t.Type2__c LIKE :finn) and t.Target_Sector2__c = :fsbo ORDER BY t.Announce_Date__c Desc';
              
               
               
                //aggregateResult res=[Select COUNT(t.Id) cnt  from Transaction__c t where t.Id in : transId];
               //system.debug('count$______________$'+res ); 
              //listSize = Integer.valueOf(res.get('cnt'));
             //system.debug('count$______________$'+listSize ); 
          
               lstQuery = null;
              // lstQuery  = Database.query(res);
             
                setCon = new ApexPages.StandardSetController(Database.query(res));
                system.debug('**********setcon'+setCon);
                setCon.setPageSize(size);
                noOfRecords = setCon.getResultSize();

}
Hi All,

       In My org Opportunity Object Contains 20 Triggers. Each trigger contains 5 Queeries. Now I am trying to inserting the record.It shows the ERROR* like this " Too many SOQL Queries 101". The triggers all are fired and it reach the governer limit .So please help me how to resolve this situation.


Thanks&Regards
Hanu
scenario 1 :
list<account> acc = [select id,name,Counter__c from account ];
for(account a : acc)
{
a.Counter__c = 'testCounter';
}
update acc;

scenario 2:

list<account> acc1=new list<account>();
list<account> acc = [select id,name,Counter__c from account ];
for(account a : acc){
a.Counter__c = 'testCounter';
    acc1.add(a);
}
update acc1;
Trigger:

trigger trg_insertdeal on DealProduct__c (after insert)
{
    List <DealProduct__c> dplist = new List <DealProduct__c >();
     map<id,Deals__c> mapDeal = new map<id,Deals__c>([Select id,name from Deals__c]);
     map<id,DealProduct__c> dealprod = new map<id,DealProduct__c>();
     map<Id,Products__c> product = new map<Id,Products__c>([select Id,NHSListPrice__c from Products__c where name =:  dplist.list__r.name]);
     if(trigger.isInsert)
      {                                
        for(DealProduct__c obj :Trigger.new)
        {
        if(product.size() > 0)
        {
       DealProduct__c dealprd = new DealProduct__c(
       NHSListPrice__c = product.get(obj.id).NHSListPrice__c);
       dplist.add(dealprd);
        }
        }
       }
}

Actually I am trying to insert 'NHSListPrice__c' field from 'Products__c' object to 'DealProduct__c' object. I cant insert. whether anything is wrong with the coding?
  • March 05, 2014
  • Like
  • 0
Hello,

We have two fields F1 and F2 in our VF page.
Both of them are picklists.
We would like to ensure that F2  is disabled (but visible) whenever F1's selected value is "X".

Can someone provide direction as to how this can be achieved ?