+ Start a Discussion
ClaiborneClaiborne 

<apex:outputfield> versus <apex:outputtext> in Summer '13

In further investigation, I have traced the problem to the following:

I retrieve the information on the opportunity and its current pricebook through this query:

o = [
    Select o.Id, o.Name, o.Amount, CurrencyIsoCode,
        o.Pricebook2Id, o.PriceBook2.Name,
        (Select Id, OpportunityId, SortOrder,
         PricebookEntryId, PriceBookEntry.Product2Id,
         PriceBookEntry.Product2.Name,
         CurrencyIsoCode,
         Quantity, TotalPrice,
         UnitPrice, ListPrice, ServiceDate,
         HasRevenueSchedule, HasQuantitySchedule,
         Description, HasSchedule
         From OpportunityLineItems)
    From Opportunity o
    where id = : apexPages.currentPage().getParameters().get('id')];

 

This works fine.

The problem is that I was displaying the pricebook name on a VisualForce page with an <apex:outputField>.

Apparently there is a change in Summer '13.

In Spring '13, this works:

<apex:outputText label="Current Price Book" value="{!o.Pricebook2.Name}"/>

In Summer '13, the page fails to load with the error:

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Currency ISO Code: invalid currency code: 000".

If I change the tag to an output text, i.e.:

<apex:outputText label="Current Price Book" value="{!o.Pricebook2.Name}"/>

Now there is no problem, and it works fine.

I just want to know why.

Best Answer chosen by Claiborne
rt3203rt3203

It might have something to do with the field 'CurrencyIsoCode' being added to the Pricebook2 Object in Summer 13'.

 

Existing Pricebook records have a '000' CurrencyIsoCode value after conversion. Updating the existing records with a "USD" value seems to be required, or you might get something like this:

 

Validation Errors While Saving Record(s)

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Currency ISO Code: invalid currency code: 000".  

 

All Answers

rt3203rt3203

It might have something to do with the field 'CurrencyIsoCode' being added to the Pricebook2 Object in Summer 13'.

 

Existing Pricebook records have a '000' CurrencyIsoCode value after conversion. Updating the existing records with a "USD" value seems to be required, or you might get something like this:

 

Validation Errors While Saving Record(s)

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Currency ISO Code: invalid currency code: 000".  

 

This was selected as the best answer
ClaiborneClaiborne
Yep. That was it.

I updated all of the pricebooks in the sandbox with USD, and the error goes
away.

Something that left out of the class notes.

--
David Claiborne | Principal | (504) 655-0000 | www.claico.com