I have been looking all over for a solution. What i have seen in other similar issues online is the error was related to code errors/user errors. I have looked over my code several times and cant see any errors. Im thinking its a bug with SF but not sure, it could just be something im not seeing. Any insight here would be helpful.
So heres the issue; when i run this on a UnitTest (with SeeAllData=true):
[
Select
Id,
PriceBookEntryId,
PriceBookEntry.Id,
PriceBookEntry.Product2Id,
PriceBookEntry.Product2.Id
FROM OpportunityLineItem
LIMIT 2
]
None of the relationship data is brought back. I only get:
(
OpportunityLineItem:{
Id=00km0000005CukEAAS,
PricebookEntryId=01u60000008g7u9AAA
},
OpportunityLineItem:{
Id=00km0000005GuebAAC,
PricebookEntryId=01u3200000DKMvZAAX
}
)
For the life of me, i can't figure out why the relationship data is not being returned. I have also tried to create my own pricebook, products, pricebook entires and opportunity-line-items and i still get the same results.
The closet i can think of is the issue is related to (SeeAllData=true), but unfortunately we are using a managed packaged that effects our opportunities and the package requires (SeeAllData=true) for any UnitTest we create. If we have SeeAllData off and create an opportunity on the UnitTest, the manage package throws errors.
Any thoughts on why im not getting the related data returned when im in the scope of a UnitTest?
P.S. This code works as expected when im not in the scope of a UnitTest.
seealldata=true
in unit test methods seems bizarre. You sure you can't mock data that MP needs?