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개
  1. 2021년 12월 22일 오전 3: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