function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jReneejRenee 

I'm getting an apex trigger error when I try to upload a newly created product in an opportunity...

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!

 

 

 

Ritesh AswaneyRitesh Aswaney

Navigate to Setup > Customize > Opportunity > Opportunity Products > Triggers

 

If you can see your trigger there, click Edit

 

When the Edit view opens up, you will see a checkbox IsActive around the top (below the Name) - uncheck and save this.

 

Be aware however, that decativation of this trigger may cause some parts that you depend on as part of your sales process to stop working.

jReneejRenee

Hello Ritesh:

 

I followed your path and found the trigger where you said it would be.  However, I can't find any way to edit the status to inactive.  Do you have anymore suggestions?

 

Thanks!

Ritesh AswaneyRitesh Aswaney

Is this in Production ? Which Edition of Salesforce do you have (Visible in the Browser header bar)

 

If this is in Production, then you will have to deploy an inactivated trigger from a Sandbox via the IDE or a ChangeSet.

 

You also need to have System Admin Profile (with Manage Application and Author Apex, etc Permissions)

DarrellDDarrellD

Do you have a Sandbox?  You cannot directly activate or deactivate a trigger in your Production environment. There are a few ways to do this such as using your Sandox or the Force.com IDE.

 

If you don't know what I'm referring to then search a little in the documentation and you wilit find it. You have to deactivate then deploy it to Production. Also, if it was from the AppExchange and part of a package, that would show up next to toe trigger.

 

The error looks like one of the fields for the trigger had no value in it.