Skip to main content

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 respostas
  1. 22 de dez. de 2021, 03:53
    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