• Sebas
  • NEWBIE
  • 0 Points
  • Member since 2008

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

Hello!

I'm having an issue while updating 2 or more OpportunityLineItems. Salesforce gives me the following error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: TotalPrice (total price must be specified): [TotalPrice]

 

And It's the wrong error.

 

The thing is that OpportunityLineItem has a cutom Text field named "testo", with the option "Do not allow duplicate values" checked, and before updating I set both line items with the same value in this text field. And unitPrice and totalPrice are not empty, for sure

 

If I uncheck the option to allow duplicate values, the error gets fixed!

 

Here I paste an Apex Test Class to reproduce this error. Just create a new Text field called testo and run the test.

I've tested this in a production enviroment and in my developer account.

 

Let me know if this is a bug or if i'm wrong

Thanks!

Regards

Sebastian

 

 

public class Test {

    @isTest
    static void myUnitTest() {
        Account a = new Account(name='client x');
        insert a;
       
        Opportunity o = new Opportunity(
            name = 'test',
            closeDate = system.today(),
            accountid = a.id,
            stageName='Close/Won'
        );
        insert o;
       
        Product2 p = new Product2(Name = 'Issue');
        insert p;
       
        Pricebook2 pb = [select Id from Pricebook2 where IsStandard = true];
        PricebookEntry pbe = new PricebookEntry(Pricebook2Id=pb.id,Product2Id=p.id, UnitPrice=15, IsActive=TRUE, UseStandardPrice=false);
        insert pbe;
       
        OpportunityLineItem li1 = new OpportunityLineItem(
            opportunityId = o.id,
            pricebookEntryId = pbe.id,
            quantity = 1,
            unitPrice = 10
        );
        insert li1;
        OpportunityLineItem li2 = new OpportunityLineItem(
            opportunityId = o.id,
            pricebookEntryId = pbe.id,
            quantity = 1,
            unitPrice = 10
        );
        insert li2;
       
        system.assertNotEquals(null, li1.unitPrice);
        system.assertNotEquals(null, [select totalPrice from opportunityLineItem where id = :li1.id].totalPrice);
        system.assertNotEquals(null, li2.unitPrice);
        system.assertNotEquals(null, [select totalPrice from opportunityLineItem where id = :li2.id].totalPrice);
       
        li1.testo__c = '1234';
        li2.testo__c = '1234';
       
        update new OpportunityLineItem[]{ li1, li2 };
    }
}

  • July 14, 2009
  • Like
  • 0
Hi

How can I use internationalization i18N in Visualforce pages similar to Resource Bundles in Java?

For example if I am using <apex:outPutText value="Hello World" /> component. I want Hello World to be displayed in other languages.

Thanks and Regards
Hello everyone, im getting the following error when inserting the pageMessages component in the sandbox enviornment:

Save error: Expression Error: Named Object: core.apexpages.components.cdk.ApexComponentRefHandler not found.

Is anyone is experiencing the same thing?