My test class works fine in sandbox. But When I'm validating this in production getting error mentioned below:
OpportunityLineItem opli2 = new OpportunityLineItem();
opli2.UnitPrice = 57;
opli2.Quantity =1;
opli2.OpportunityId=opp.Id;
opli2.pricebookentryid=customPrice.Id;
insert opli2; // Stacktrace Line where insert failed and throwing exception
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry is in a different pricebook than the one assigned to the opportunity): [PricebookEntryId]
Any helping hand will really be appreciated.