• jRenee
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I get this error when I try to mass edit opportunity list views.  Does anyone have a solution for this?  I'm lost...
  • January 29, 2022
  • Like
  • 0
The directions said to locate and check the Show HTML checkbox, but it wasn't there to check.

So I added the code anyway (see below):

<center><div style="width: 850px; border-width: 1px; border-style: solid; background-color: rgb(255, 255, 204); border-color: rgb(51, 153, 255); font-size: 20px; color: black"><marquee scrollamount="6" direction="right" behavior="alternate" onmouseout='this.scrollAmount=6" onmouseover="this.scrollAmount=0" width="850px">NEW Activities Tab Tracks Your Tasks and Events</marquee></div></center>

When I preview it on the Home Page layout, it shows the code written out...what am I doing wrong?

Help me...

-Renee
  • October 21, 2014
  • Like
  • 0

Hello:

 

There are two active WFR about product discounts under the Opportunity Product object that are triggered by an Apex Trigger.  They are currently causing problems in the system - throwing out errors and automatically inserting a discount when not needed.  What happens if I deactivate the workflow rules?  Will it cause problems with the products on the opportunities pages that are currently using the rules?

 

Thank you,

Renee

  • December 05, 2012
  • Like
  • 0

Hello:

 

I'm back with the same issue with further developments. I'm hoping someone will take a look and recognize what's happening and why.

 

No one claimed to be using the discount, so I copied the apex trigger into my sandbox, preparing to deactivate it.  However, yesterday I found out someone is using the apex trigger and so I probably need to modify the code or something.  Below is the error message that we get when trying to upload a NEWLY CREATED product onto an opportunity page.

 

Apex trigger OpportunityDiscountCalculation caused an
unexpected exception, contact your administrator:
OpportunityDiscountCalculation: execution of BeforeInsert caused by:
System.NullPointerException: Attempt to de-reference a null object:
Trigger.OpportunityDiscountCalculation: line 11, column 1
  

 

Below is the actual apex trigger that I'm convinced someone from Salesforce created for our previous System Administrator, as she was brand new to the system.  Anyone recognize it?

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40trigger OpportunityDiscountCalculation on OpportunityLineItem (before insert, before update) {   List<String> priceBookIds = new List<String>();   for(OpportunityLineItem oli : Trigger.New) {     if(oli.PricebookEntryId != null)       priceBookIds.add(oli.PriceBookEntryId);   }   Map<Id, PricebookEntry> productCodeMap = new Map<Id, PricebookEntry>([Select Id, ProductCode, Product2.Revenue_Type__c from PricebookEntry where Id in :priceBookIds]);   for(OpportunityLineItem oli : Trigger.New) {     if(trigger.isInsert || oli.Quantity != Trigger.oldMap.get(oli.Id).Quantity) {       Double totalDiscount = 0.0;       if(productCodeMap.containsKey(oli.PricebookEntryId) && (productCodeMap.get(oli.PriceBookEntryId).ProductCode.startsWith('PPM') || productCodeMap.get(oli.PriceBookEntryId).ProductCode.startsWith('PPE')) && (productCodeMap.get(oli.PriceBookEntryId).Product2.Revenue_Type__c == null || !productCodeMap.get(oli.PriceBookEntryId).Product2.Revenue_Type__c.contains('Maintenance'))) {         for(Integer i = 1; i <= oli.Quantity; i++) {           if(i >= 6 && i <= 10) {             totalDiscount += 5;           }           else if(i >= 11 && i <= 20) {             totalDiscount += 10;           }           else if(i >= 21 && i <= 30) {             totalDiscount += 15;           }           else if(i >= 31 && i <= 40) {             totalDiscount += 20;           }           else if(i >= 41 && i <= 50) {             totalDiscount += 25;           }           else if(i >= 51 && i <= 75) {             totalDiscount += 30;           }           else if(i >= 76) {             totalDiscount += 35;           }         }       }       totalDiscount = totalDiscount / oli.Quantity;       oli.Discount_Percentage__c = totalDiscount;     }   } }

 

Oh well, doesn't look like it copied correctly on this.  Sorry.

 

I was hoping that someone could assist me in modifying the code so we don't get this error anymore.

 

Thanks again,

Renee

  • November 16, 2012
  • Like
  • 0

Hello:

 

After creating a new product, I tried uploading it into a new opportunity and an apex trigger error appeared and wouldn't allow me to go any further.  No one has ever seen this error come up before.  It only happens when trying to upload a brand new product.  The error message is:

 

 

Apex trigger OpportunityDiscountCalculation caused an unexpected exception, contact your administrator: OpportunityDiscountCalculation: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.OpportunityDiscountCalculation: line 11, column 1

 

 

I tracked down this apex trigger that was developed by our previous system admin about 2 years ago.  There is no information about whether it was created from an app we got from the AppExchange. I don't know how to deactivate it.

 

Any suggestions?

 

I appreciate your consideration!

 

 

 

  • November 06, 2012
  • Like
  • 0
The directions said to locate and check the Show HTML checkbox, but it wasn't there to check.

So I added the code anyway (see below):

<center><div style="width: 850px; border-width: 1px; border-style: solid; background-color: rgb(255, 255, 204); border-color: rgb(51, 153, 255); font-size: 20px; color: black"><marquee scrollamount="6" direction="right" behavior="alternate" onmouseout='this.scrollAmount=6" onmouseover="this.scrollAmount=0" width="850px">NEW Activities Tab Tracks Your Tasks and Events</marquee></div></center>

When I preview it on the Home Page layout, it shows the code written out...what am I doing wrong?

Help me...

-Renee
  • October 21, 2014
  • Like
  • 0

Hello:

 

After creating a new product, I tried uploading it into a new opportunity and an apex trigger error appeared and wouldn't allow me to go any further.  No one has ever seen this error come up before.  It only happens when trying to upload a brand new product.  The error message is:

 

 

Apex trigger OpportunityDiscountCalculation caused an unexpected exception, contact your administrator: OpportunityDiscountCalculation: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.OpportunityDiscountCalculation: line 11, column 1

 

 

I tracked down this apex trigger that was developed by our previous system admin about 2 years ago.  There is no information about whether it was created from an app we got from the AppExchange. I don't know how to deactivate it.

 

Any suggestions?

 

I appreciate your consideration!

 

 

 

  • November 06, 2012
  • Like
  • 0