Skip to main content Take our 5-minute Community Survey. Open now through 4/11/2025. Click here to participate.

I have the following SOQL which when run in Query Editor returns 1 record

Select Id, Name from Product2 where ProductCode = 'PKGA'

But when I use the sampe query in an Apex test, there are no records returned.

List<Product2> ProdList = [Select Id, Name from Product2 where ProductCode = 'PKGA'];

 
2 answers
  1. Dec 22, 2021, 3:53 AM
    Hi Jon,

    Please follow below vode:-

     

    List<Product2> ProdList = [Select Id, Name from Product2 where ProductCode = 'PKGA'];

    system.debug('ProdList Size ->> '+ProdList.size());

    if you need any assistanse, Please let me know!!

    Kindly mark my solution as the best answer if it helps you.

    Thanks

    Mukesh
Loading
0/9000