[SalesForce] Why I can edit an apex class in sandbox, but not production. What works in sandbox fails to deploy in production.

I installed an unmanaged app (by @michaelforce http://goo.gl/8rx7t) to enhance the "Add Products to Opp" page. It works great in both Prod and Sandbox.

However, I need to add the Discount field to the VF page. Since Discount is not included in the select statement in the opportunityProductEntryExtension apex class, the page breaks when adding the code itself to the opportunityProductEntry VF page.

I tried to do an outbound/inbound change (Sandbox to Prod) and get this error:
Failure Message: "System.AssertException: Assertion Failed", Failure Stack Trace: "Class.opportunityProductEntryTests.theTests: line 80, column 1"

Here are lines 76 – 84 (bold 81)
76 }
77
78 public String getChosenCurrency(){
79
80 if(multipleCurrencies)
81 return (String)theOpp.get('CurrencyIsoCode');
82 else
83 return '';
84 }

We do not have multiple currencies set up. I cannot comment out this section as it is referenced in opportunityProductEntry

I cannot edit the class in prod, and cannot successfully deploy the updated, working-in-sandbox Apex class to Production. I also can't figure the error on line 80, above.

QUESTIONS:

  • It is possible to make the Discount field available to the controller
    via a statement on the opportunityProductEntry VF page? How?

  • Should I attempt to edit the Apex page in production another way (via
    eclipse?)?

  • Can the Currencies error above be remedied?

  • Any other ideas?

Best Answer

What is the actual assert? I'm assuming there's a line in a test method which calls getChosenCurrency() and checks the result of it for a specific value.

Chances are you could just comment out that part of the test (any parts dependant on it) without taking too large a hit on the test coverage. Posting the test code where the assertion is would make it a lot easier for people to help you with this.

Related Topic