You need to sign in to do that
Don't have an account?
padmini ss
FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (must have the same currency as the order): [PricebookEntryId]
Hi This is my Test class its working fine Sandbox 93% coverage, but while moving to production
i am getting this error
FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (must have the same currency as the order): [PricebookEntryId]
thanks
i am getting this error
FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (must have the same currency as the order): [PricebookEntryId]
@isTest(seeAllData=TRUE) private class testSalesOrderReportGenerator { static testMethod void testSalesOrderReportGenerator() { List<OrderItem > lstoplitm= new list<OrderItem>(); Account a = new Account(name ='testac1',BillingCity='BillingAddress',BillingCountry='India',BillingStreet='test BillingStreet',BillingPostalCode='12345',BillingState='Haryana'); insert a; Product2 prod = new Product2(Name = 'Laptop X200',Family = 'Hardware'); insert prod; Id pricebookId = Test.getStandardPricebookId();//This is available irrespective of the state of SeeAllData. PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prod.Id,UnitPrice = 10000, IsActive = true); insert standardPrice; PriceBook2 pb2Standard = [select Id from Pricebook2 where isStandard=true]; PricebookEntry pbe = [ SELECT Id,Product2Id,Pricebook2Id,UnitPrice FROM PricebookEntry WHERE Pricebook2Id = :pb2Standard.Id AND isActive=true LIMIT 1 ]; Order o = new Order(name='test opp1',Status= 'Draft' , AccountId=a.id,CurrencyIsoCode= 'USD',EffectiveDate = Date.today(),Pricebook2Id = pb2Standard.Id); insert o; OrderItem op=new OrderItem (PriceBookEntryId=pbe.Id,quantity=1,Orderid=o.id,UnitPrice=pbe.UnitPrice ); //insert op; lstoplitm.add(op); insert lstoplitm;only in after this my business logic works, please kindly help me .
thanks
Make a query on PricebookEntry and Oder to fetch the CurrencyIsoCode
and put the debug to check that both are same.
If not same then set the same for both.
All Answers
make a try by removing
CurrencyIsoCode= 'USD'
from Order.
Removed
CurrencyIsoCode= 'USD'
from Order., but still same error in only production @anoop
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (must have the same currency as the order): [PricebookEntryId]
Stack Trace: Class.testSalesOrderReportGenerator.testSalesOrderReportGenerator: line 34, column 1,
pls help me out..
Make a query on PricebookEntry and Oder to fetch the CurrencyIsoCode
and put the debug to check that both are same.
If not same then set the same for both.
PricebookEntry & in Oder), i am in tension ...need to be moved to prodction urgently ..kindly help me..!!
Why you are using the below Line? Use the below one instead.