• ami anu
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi everyone,
i'm very much new to salesforce and i have written a trigger which has accomplished the task,but when there are many records its throwing an error: TOO MANY SQL QUERIES:101.

here is my trigger ,pls help me out with this issue

 




Trigger fieldupdate on External_Verification_Opinion__c (After insert,after update)
{  

   list<External_Verification_Opinion__c> evo = [SELECT id,         Final_Opinion__c, RecordTypeId,    Relationship_Form__c FROM External_Verification_Opinion__c where Final_Opinion__c=:'Approved' ];
 for(External_Verification_Opinion__c e : evo) 
  { 
 list<Relationship__c> rf = [SELECT Id,Sent_For_External_Verification__c,Product_Family__c                                 FROM Relationship__c where id=:e.Relationship_Form__c and Sent_For_External_Verification__c=:'yes'];    
for(Relationship__c re : rf)  
 {   
  if((e.RecordTypeId=='012f00000004KhI') && ((re.Product_Family__c=='Saving Accounts') ||(re.Product_Family__c=='credit cards') || (re.Product_Family__c=='Mortgage') ||(re.Product_Family__c=='personal loans'))) 
        {            
         re.Verifier__c=true;     
          update re;     
         }          
if(((e.RecordTypeId=='012f00000004K2e') && (re.Product_Family__c=='Mortgage')) )  
       {          
         re.Technical_Valuator__c=true;       
         update re;           
        }     
if(((e.RecordTypeId=='012f00000004K2j') && (re.Product_Family__c=='Mortgage')) )  
       {          
           re.Solicitor__c=true;    
           update re;            
        }   
  if((e.RecordTypeId=='012f00000004KhJ') && ((re.Product_Family__c=='credit cards') || (re.Product_Family__c=='Mortgage') ||(re.Product_Family__c=='personal loans')))    
     {    
       re.Credit_Agency__c=true;    
       update re;               }        
          } 
  } 
}





Hi everyone,
i'm very much new to salesforce and i have written a trigger which has accomplished the task,but when there are many records its throwing an error: TOO MANY SQL QUERIES:101.

here is my trigger ,pls help me out with this issue

 




Trigger fieldupdate on External_Verification_Opinion__c (After insert,after update)
{  

   list<External_Verification_Opinion__c> evo = [SELECT id,         Final_Opinion__c, RecordTypeId,    Relationship_Form__c FROM External_Verification_Opinion__c where Final_Opinion__c=:'Approved' ];
 for(External_Verification_Opinion__c e : evo) 
  { 
 list<Relationship__c> rf = [SELECT Id,Sent_For_External_Verification__c,Product_Family__c                                 FROM Relationship__c where id=:e.Relationship_Form__c and Sent_For_External_Verification__c=:'yes'];    
for(Relationship__c re : rf)  
 {   
  if((e.RecordTypeId=='012f00000004KhI') && ((re.Product_Family__c=='Saving Accounts') ||(re.Product_Family__c=='credit cards') || (re.Product_Family__c=='Mortgage') ||(re.Product_Family__c=='personal loans'))) 
        {            
         re.Verifier__c=true;     
          update re;     
         }          
if(((e.RecordTypeId=='012f00000004K2e') && (re.Product_Family__c=='Mortgage')) )  
       {          
         re.Technical_Valuator__c=true;       
         update re;           
        }     
if(((e.RecordTypeId=='012f00000004K2j') && (re.Product_Family__c=='Mortgage')) )  
       {          
           re.Solicitor__c=true;    
           update re;            
        }   
  if((e.RecordTypeId=='012f00000004KhJ') && ((re.Product_Family__c=='credit cards') || (re.Product_Family__c=='Mortgage') ||(re.Product_Family__c=='personal loans')))    
     {    
       re.Credit_Agency__c=true;    
       update re;               }        
          } 
  } 
}





Hi,

 

I am unable to get this to work.

I am trying to render a pageblock based on the selection of the picklist value. if the Opportunitystage=='Qualification' i want to then render the close date field.

in the below code i want to display the Closedate only when an Opportunity stage is selected and equals to "Qualification"

I don't know if i am doing any AJAX requests incorrectly.Can any one help me with this.

 

Page:

<apex:page standardController="Opportunity">
  <apex:form >
    <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="edit">
   
      <apex:pageBlockButtons location="bottom" >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>               
      </apex:pageBlockButtons>

    <apex:pageBlockSection columns="1">
      <apex:inputField value="{!opportunity.name}"/>
      <apex:pageBlockSectionItem >
      <apex:outputLabel value="{!$ObjectType.opportunity.fields.stageName.label}" 
                        for="stage"/>
      <!-- 
           Without the actionregion, selecting a stage from the picklist would cause 
           a validation error if you hadn't already entered data in the required name 
           and close date fields.  It would also update the timestamp.
      -->  
    
      <apex:actionRegion renderRegiononly="{!opportunity.stageName !='Qualification'}" >
        <apex:inputField value="{!opportunity.stageName}" id="stage">
          <apex:actionSupport event="onchange" rerender="ajaxrequest"
                              status="status"/>
          </apex:inputField>
          </apex:actionRegion>
      </apex:pageBlockSectionItem>
        
       
        </apex:pageBlockSection>
        
          <apex:outputPanel id="ajaxrequest" rendered="{!Opportunity.StageName}" > 
              <apex:inputField value="{!Opportunity.CloseDate}"/>
             {!text(now())}
          </apex:outputPanel> 
        
      </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks,

Sales4ce