• HaroldC
  • NEWBIE
  • 0 Points
  • Member since 2012

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

I'm trying to override the logging at the class level.  I'm trying to debug 1 class, but it's nearly impossible to find anything for that class in the log because there is so much information for all the other classes and triggers.  So I try going to the classes that I don't care about and at the class detail level I choose log filters, overide and set everything to none.  As soon as I click on another class to set its log level and come back to the first class all the filters reset.  I don't get how I can save those filters, there's no save button.  Anyone have an idea how to set and save the log filters at the class level?  I'd like to shut off all the classes except for the one I'm debugging.

 

Thanks

  • September 25, 2012
  • Like
  • 0

Is it possible to write a trigger on the Opportunity Split Object?

  • December 07, 2013
  • Like
  • 0

Hi Everyone!

 

I am writing an apex trigger. The trigger is designed to fire when a revenue event is created. The trigger is suposed to perform a query on Accounts to find an item called Commission Calculation. If the Commission Calculation is active, the trigger gets the Sales Agent's ID and the Commission Calculation ID, which it uses to populate fields in the Commission record. 

 

My problem is I can't see to find a way to get the For loop to operate correctly. Below is the trigger in all its glory. If anyone can help it would be deeply appreciated!

 

trigger GenerateCommission on Revenue_Event__c (after insert) {

For (Revenue_Event__c NewRevenueEvent : Trigger.new){

If (NewRevenueEvent != null)
{
list <Account> CommissionList = [SELECT Id,
(SELECT id, Sales_Agent__C FROM Commission_Calculations__r WHERE Active__c = TRUE)
FROM Account];

Integer i = CommissionList.size();

list <Commission__c> NewCommission = new list <Commission__c>();

for (Account j : NewCommissionList) {
NewCommission[0].Revenue_Event__c = NewRevenueEvent.id;
NewCommission[0].Sales_Agent__c = CommissionList[0].Commission_Calculations__r.get(0).Sales_Agent__c;
NewCommission[0].Commission_Percentage__c = CommissionList[0].Commission_Calculations__r.get(0).id;
}
// Insert NewCommission[0];
}

}
}

Currently have the following trigger which works perfectly for one record inside our production organization:

 

trigger createCommissionClosedWon on Opportunity ( before insert, before update) {
    Opportunity[] opps = Trigger.New;
    for (Opportunity o:opps){
    If (o.StageName == 'Closed Won')
       CreateCommissionRecords.createCommissionRecords(opps);
}}

 I'm trying to bulkify this trigger so that it performs well under bulk updates..... The following code creates an error when I try and save:

 

trigger createCommissionClosedWon on Opportunity (before insert, before update) {

    for (Opportunity opps: Trigger.New){
    	If (opps.Stage == 'Closed Won'){
   		CreateCommissionRecords.createCommissionRecords(opps);
}}}

 What am I doing Wrong??? This is the error message that I'm receiveing: Save error: Method does not exist or incorrect signature: CreateCommissionRecords.createCommissionRecords(SOBJECT:Opportunity)  

 

it sounds like a variable / definitional problem.... Thanks so much for helping me.....