+ Start a Discussion
ShunnShunn 

FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code): [PricebookEntryId

Hi All,

I am getting the above error when trying to deploy a class from sandbox to production:
This is the portion of the script that is been referenced.

       Opportunity oppty3 = new Opportunity (
            AccountId = acc.Id,
            Type = 'Renewal',
            StageName = 'Closed Won',
            Name = 'Test Oppty - Renewal',
            CloseDate = date.newInstance(1990, 11, 21),
            OwnerId = 'abcd123456789',
            Amount = 1000,
           Product__c = 'Ducks',
            Renewal_Contact__c = cont.Id,
            Renewal_Date__c = date.newInstance(1990, 11, 21).addYears(3),
            Term__c = '1 year',
            Fee_Amount__c = 100,
            Support_Amount__c = 50,
            Choice__c = 'sddasdasdas',
            Choice_Date__c = date.newInstance(1990, 11, 21),
            Choice_Status__c = 'Open',
            Renewal_Created__c = false,
            Pain_Points__c  = 'ouch',
            LeadSource = 'sfds');
            Insert oppty3;
            

            OpportunityLineItem item3 = new opportunityLineItem (
            OpportunityId = oppty3.Id,
            Quantity = 1,
            TotalPrice = 10000,
            PricebookEntryId = '123456789123456'
            );
            insert item3;


Any ideas please?
AbhishekAbhishek (Salesforce Developers) 
Hi Shunn,

Can you provide me the complete error message like Gack ID.