• JGraf
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
I have a trigger in my org that I didn't write.  From my slight understanding of triggers, this doesn't look like it does anything.  Below is the entire trigger.  Can you tell me if this is just cluttering up my org?

1 trigger UpdateEQLineOnProjTask on AcctSeed__Project_Task__c (after update) {
2    
3 }
  • January 18, 2016
  • Like
  • 0
I am an experienced Administrator but a very, very green Developer.  Someone was nice enough to write this trigger for me and it worked great in my sandbox and it still works great for me in Production but my users are getting the infamous "Too Many SOQL Queries" message while I do same exact thing and it runs fine.  Is there something I am missing?

This is the code.
 trigger UpdateEQLineOnProjTask on AcctSeed__Project_Task__c (after update) {
    
    try{
        List<AcctSeed__Project_Task__c>  projectTaskList = new List<AcctSeed__Project_Task__c>();
        Map<String,Specification_Default__c> specDefaultMap  = new Map<String,Specification_Default__c>();
        for(Specification_Default__c specDefault : [Select Id,Name from Specification_Default__c ]){
            specDefaultMap.put(specDefault.Id,specDefault);
        }
        List<EQLines__c> addEqLineList = new List<EQLines__c>();
        List<EQLines__c> deleteEqLineList = new List<EQLines__c>();
        for(AcctSeed__Project_Task__c  prjcttask:Trigger.new){
            if(prjcttask.Model_Number_1__c!=null)
            {
                
                List<EQLines__c>  eqLineList = [Select Id, Name from EQLines__c Where Project_Task__c =:prjcttask.Id ];
                if(eqLineList.size()>0){
                    if(prjcttask.Model_Number_1__c != Trigger.oldMap.get(prjcttask.Id).Model_Number_1__c){
                        deleteEqLineList = eqLineList;
                        //This Query needs to be modified in case you add new fields to EQLine
                        List<EQLines__c>  newEqLineList = [Select Id, Name, AI__c, Amps__c, AO__c, DI__c, Dimensions__c,DO__c,HP__c, Manufacturer__c,Manufacturer_Model__c, Material_of_Construction__c, Max_Flow__c , Max_Pressure__c,Shipping_Notes__c,Transmitter_Type__c,Voltage__c,WWW_Part_Number__c, Process_Fluid__c from EQLines__c Where Specification_Default__c =:prjcttask.Model_Number_1__c ];
                        Specification_Default__c SD = new Specification_Default__c();
                        if(specDefaultMap.size()>0)
                            SD = specDefaultMap.get(prjcttask.Model_Number_1__c);
                        List<EQLines__c> clonedEqLineList = newEqLineList.deepClone(false,false,false);
                        addEqLineList.clear();
                        for(EQLines__c eqLine: clonedEqLineList){
                            eqLine.Name = eqLine.Name+SD.Name+prjcttask.Name;
                            eqLine.Project_Task__c = prjcttask.Id;
                            addEqLineList.add(eqLine);
                        }
                    }
                }
                else{
                    //This Query needs to be modified in case you add new fields to EQLine
                    List<EQLines__c>  newEqLineList = [Select Id, Name, AI__c, Amps__c, AO__c, DI__c, Dimensions__c,DO__c,HP__c, Manufacturer__c,Manufacturer_Model__c, Material_of_Construction__c, Max_Flow__c , Max_Pressure__c,Shipping_Notes__c,Transmitter_Type__c,Voltage__c,WWW_Part_Number__c, Process_Fluid__c from EQLines__c Where Specification_Default__c =:prjcttask.Model_Number_1__c ];
                    Specification_Default__c SD = new Specification_Default__c();
                    if(specDefaultMap.size()>0)
                        SD = specDefaultMap.get(prjcttask.Model_Number_1__c);
                    List<EQLines__c> clonedEqLineList = newEqLineList.deepClone(false,false,false);
                    addEqLineList.clear();
                    for(EQLines__c eqLine: clonedEqLineList){
                        eqLine.Name = eqLine.Name+SD.Name+prjcttask.Name;
                        eqLine.Project_Task__c = prjcttask.Id;
                        addEqLineList.add(eqLine);
                    }
                }           
            }
            else{
                deleteEqLineList = [Select Id, Name from EQLines__c Where Project_Task__c =:prjcttask.Id ];
            }
        }
        delete deleteEqLineList;
        insert addEqLineList;
    }
    catch(Exception e){
        system.debug('The following error occured ' + e.getMessage());
    }
}

If it helps, the error is occuring when they hit a button that is a Deep Clone of the grandparent object of the EQLine Object in this trigger.  When the new trigger is run on an individual level, this seems to not be an issue.  In the very least, I need to know how to deactivate the trigger temporarily.  Hopefully this unexpected adventure will kick start my understanding of the dev side of Salesforce.
Thanks!
  • May 07, 2015
  • Like
  • 0

We have a custom button that draws into a VisualForce Page.  I want to move this button from the Detail Page and add it to the List view of it its parent record.  This would enable me to perform this action for multiple records at once.

The issue I am having is when I edit the button to change from "Detail Page Button" to "List Button".  When List Button is selected, the VisualForce Page previously used is no longer an option under Content.  Is there some coding that I need to change to allow this switch, or is there a setting on the Page or Class that need to edit?

I am a Sys Admin with just enough Coding knowledge to keep myself out of trouble but not enough to be an effective developer.

  • October 27, 2012
  • Like
  • 0

I am trying to display all the Child Records within a "pageBlockTable" using the parent as the Standard Controller but I can't seem to figure out the correct Value.  How do I identify the correct term?  

 

While I'm here, I don't seem to understand the idea behind the "var".  Is this something I need?

  • August 27, 2012
  • Like
  • 0

I want to create a button on a master object that hits a specific button on every child object of that record.  I have about a year's worth of Salesforce under my belt.  What would be the best resource to learn how to do this?  Am I jumping in over my head? 

  • July 23, 2012
  • Like
  • 0
I have a trigger in my org that I didn't write.  From my slight understanding of triggers, this doesn't look like it does anything.  Below is the entire trigger.  Can you tell me if this is just cluttering up my org?

1 trigger UpdateEQLineOnProjTask on AcctSeed__Project_Task__c (after update) {
2    
3 }
  • January 18, 2016
  • Like
  • 0
I have built and rebuilt this challenge and keep getting this UnHandled fault error after the last step of creating the Opportunity. 
I have removed the creation of the Oppy and everything works. But when adding Oppy it causes this error. 

Anyone else have this issue?

We have a custom button that draws into a VisualForce Page.  I want to move this button from the Detail Page and add it to the List view of it its parent record.  This would enable me to perform this action for multiple records at once.

The issue I am having is when I edit the button to change from "Detail Page Button" to "List Button".  When List Button is selected, the VisualForce Page previously used is no longer an option under Content.  Is there some coding that I need to change to allow this switch, or is there a setting on the Page or Class that need to edit?

I am a Sys Admin with just enough Coding knowledge to keep myself out of trouble but not enough to be an effective developer.

  • October 27, 2012
  • Like
  • 0

I am trying to display all the Child Records within a "pageBlockTable" using the parent as the Standard Controller but I can't seem to figure out the correct Value.  How do I identify the correct term?  

 

While I'm here, I don't seem to understand the idea behind the "var".  Is this something I need?

  • August 27, 2012
  • Like
  • 0