• Nataku
  • NEWBIE
  • 10 Points
  • Member since 2014

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

My manager is aking me to "theme" Salesforce into our companies' color scheme. From some research it appears that the only way to do it is to recreate each page within VisualForce. I managed to get the details page and list page done, but now I'm stuck  trying to figure out how to recreate the landing page when you click on a Tab. (the one where it shows recent items) I've tried recreating each object, but then couldn't figure out how to recreate the drop down to select views. Can someone help me with the code needed to create that object or even better some sort of code that just recreate the page like what I'm doing to recreate the detail/list page
<apex:enhancedlist type="Account" height="730" customizable="false" rowsPerPage="25"/>

Getting the feeling that Home and Report is going to be a pain too... but I'll save that for another time.

Thanks,
  • October 30, 2014
  • Like
  • 0
Hi Guys,

I'm running into to the governor limit - Too many SOQL query 101
My trigger works normally until I tried to dump 2.5k worth of records in. I thought I was batchifying code properly, but now I'm confused. (btw I tried moving the AggregatedResult out from - for(AggregatedResult ar) - to it's own line and it ran into the same issue. May be I'm looking in the wrong place?

trigger HQDisplayTotalNewAccount on Account (after insert, after undelete)
{
	//variable to keep all HQ IDs for processing
	Set<Id> parentIds = new Set<Id>();
	
	//grab what was being saved first
    for (Account acc : Trigger.new)
    {
    	//process if a child, else change the values back
        if (acc.ParentId != null)
        {
            parentIds.add(acc.ParentId);
        }
    }
    
    if (parentIds.size() > 0)
    {
        List<Account> updates = new List<Account>();
        
        // Leave the job of calculating the sum to the database
        for (AggregateResult ar : 
        		[
                SELECT ParentId p
                		,sum(Couture_Display__c) sumCD
                		,sum(Abode_Display__c) sumAD
                		,sum(KW_Gallery_Display__c) sumKGD
                		,sum(KW_Gallery_Cabinet__c) sumKGC
                		,sum(KW_Tower_Display__c) sumKTD
                		,sum(KW_Wire_Rack__c) sumKWR
                		,sum(KW_Mod_10__c) sumKMT
                		,sum(Evoke_Lam_Gallery_Display__c) sumELGD
                		,sum(Evoke_LV_Gallery_Display__c) sumELVG
                		,sum(Evoke_Gallery_Cabinet__c) sumEGC
                		,sum(Evoke_Tower_Display__c) sumETD
                		,sum(Evoke_Wire_Rack__c) sumEWR
                		,sum(Evoke_Mod_10__c) sumEMT
                		,sum(X2012_Sales__c) sumTW
                		,sum(X2013_Sales__c) sumTR
                		,sum(X2014_Sales__c) sumFO
                FROM Account
                WHERE ParentId in :parentIds
                GROUP BY ParentId
                ])
        {
        	
            // Update without the cost of a preceding query
            updates.add(new Account(Id = (Id) ar.get('p')
            						, Couture_Display__c = (Decimal) ar.get('sumCD')
            						, Abode_Display__c = (Decimal) ar.get('sumAD')
            						, KW_Gallery_Display__c = (Decimal) ar.get('sumKGD')
            						, KW_Gallery_Cabinet__c = (Decimal) ar.get('sumKGC')
            						, KW_Tower_Display__c = (Decimal) ar.get('sumKTD')
            						, KW_Wire_Rack__c = (Decimal) ar.get('sumKWR')
            						, KW_Mod_10__c = (Decimal) ar.get('sumKMT')
            						, Evoke_Lam_Gallery_Display__c = (Decimal) ar.get('sumELGD')
            						, Evoke_LV_Gallery_Display__c = (Decimal) ar.get('sumELVG')
            						, Evoke_Gallery_Cabinet__c = (Decimal) ar.get('sumEGC')
            						, Evoke_Tower_Display__c = (Decimal) ar.get('sumETD')
            						, Evoke_Wire_Rack__c = (Decimal) ar.get('sumEWR')
            						, Evoke_Mod_10__c = (Decimal) ar.get('sumEMT')
            						, X2012_Sales__c = (Decimal) ar.get('sumTW')
            						, X2013_Sales__c = (Decimal) ar.get('sumTR')
            						, X2014_Sales__c = (Decimal) ar.get('sumFO')
            						)
            		   );
        }
        
        
        // This update will cause this trigger to fire again
        update updates;
    }

}
Oh, and this trigger is suppose to add up each column from all the child under a parent and then update that column in the parent with the total.

Thanks,

  • August 11, 2014
  • Like
  • 0
Hi All,

My manager is aking me to "theme" Salesforce into our companies' color scheme. From some research it appears that the only way to do it is to recreate each page within VisualForce. I managed to get the details page and list page done, but now I'm stuck  trying to figure out how to recreate the landing page when you click on a Tab. (the one where it shows recent items) I've tried recreating each object, but then couldn't figure out how to recreate the drop down to select views. Can someone help me with the code needed to create that object or even better some sort of code that just recreate the page like what I'm doing to recreate the detail/list page
<apex:enhancedlist type="Account" height="730" customizable="false" rowsPerPage="25"/>

Getting the feeling that Home and Report is going to be a pain too... but I'll save that for another time.

Thanks,
  • October 30, 2014
  • Like
  • 0
Hi Guys,

I'm running into to the governor limit - Too many SOQL query 101
My trigger works normally until I tried to dump 2.5k worth of records in. I thought I was batchifying code properly, but now I'm confused. (btw I tried moving the AggregatedResult out from - for(AggregatedResult ar) - to it's own line and it ran into the same issue. May be I'm looking in the wrong place?

trigger HQDisplayTotalNewAccount on Account (after insert, after undelete)
{
	//variable to keep all HQ IDs for processing
	Set<Id> parentIds = new Set<Id>();
	
	//grab what was being saved first
    for (Account acc : Trigger.new)
    {
    	//process if a child, else change the values back
        if (acc.ParentId != null)
        {
            parentIds.add(acc.ParentId);
        }
    }
    
    if (parentIds.size() > 0)
    {
        List<Account> updates = new List<Account>();
        
        // Leave the job of calculating the sum to the database
        for (AggregateResult ar : 
        		[
                SELECT ParentId p
                		,sum(Couture_Display__c) sumCD
                		,sum(Abode_Display__c) sumAD
                		,sum(KW_Gallery_Display__c) sumKGD
                		,sum(KW_Gallery_Cabinet__c) sumKGC
                		,sum(KW_Tower_Display__c) sumKTD
                		,sum(KW_Wire_Rack__c) sumKWR
                		,sum(KW_Mod_10__c) sumKMT
                		,sum(Evoke_Lam_Gallery_Display__c) sumELGD
                		,sum(Evoke_LV_Gallery_Display__c) sumELVG
                		,sum(Evoke_Gallery_Cabinet__c) sumEGC
                		,sum(Evoke_Tower_Display__c) sumETD
                		,sum(Evoke_Wire_Rack__c) sumEWR
                		,sum(Evoke_Mod_10__c) sumEMT
                		,sum(X2012_Sales__c) sumTW
                		,sum(X2013_Sales__c) sumTR
                		,sum(X2014_Sales__c) sumFO
                FROM Account
                WHERE ParentId in :parentIds
                GROUP BY ParentId
                ])
        {
        	
            // Update without the cost of a preceding query
            updates.add(new Account(Id = (Id) ar.get('p')
            						, Couture_Display__c = (Decimal) ar.get('sumCD')
            						, Abode_Display__c = (Decimal) ar.get('sumAD')
            						, KW_Gallery_Display__c = (Decimal) ar.get('sumKGD')
            						, KW_Gallery_Cabinet__c = (Decimal) ar.get('sumKGC')
            						, KW_Tower_Display__c = (Decimal) ar.get('sumKTD')
            						, KW_Wire_Rack__c = (Decimal) ar.get('sumKWR')
            						, KW_Mod_10__c = (Decimal) ar.get('sumKMT')
            						, Evoke_Lam_Gallery_Display__c = (Decimal) ar.get('sumELGD')
            						, Evoke_LV_Gallery_Display__c = (Decimal) ar.get('sumELVG')
            						, Evoke_Gallery_Cabinet__c = (Decimal) ar.get('sumEGC')
            						, Evoke_Tower_Display__c = (Decimal) ar.get('sumETD')
            						, Evoke_Wire_Rack__c = (Decimal) ar.get('sumEWR')
            						, Evoke_Mod_10__c = (Decimal) ar.get('sumEMT')
            						, X2012_Sales__c = (Decimal) ar.get('sumTW')
            						, X2013_Sales__c = (Decimal) ar.get('sumTR')
            						, X2014_Sales__c = (Decimal) ar.get('sumFO')
            						)
            		   );
        }
        
        
        // This update will cause this trigger to fire again
        update updates;
    }

}
Oh, and this trigger is suppose to add up each column from all the child under a parent and then update that column in the parent with the total.

Thanks,

  • August 11, 2014
  • Like
  • 0