简体   繁体   English

Salesforce-列表没有返回行

[英]Salesforce - List has no rows returned

When i checked in Database the same query returning 18 rows, but in my Apex class it is retuning zero rows as in 当我在数据库中签入相同的查询返回18行时,但是在我的Apex类中,它正在重新调整零行,如

 List<Account> accList=[SELECT Name,Id,ShippingStreet,ShippingState,ShippingCountry,ShippingCity,ShippingPostalCode
                           FROM Account];
 System.debug('accList size:'+accList.size());

Please check their snapshots attached below, 请检查下面所附的快照, 在此处输入图片说明

在此处输入图片说明

Please tell me the error happening in my code. 请告诉我代码中发生的错误。

Finally I have resolved the issue. 终于我解决了这个问题。 I am running those statements in a apex Test class, I forget to include the insert statements for the coresponding records, after adding the below statements to my code, 我在apex Test类中运行这些语句,在将以下语句添加到我的代码中之后,我忘记为核心响应记录包括insert语句,

    Account acc=new Account(Name='test',ShippingStreet='Test address');
    insert acc;

Resolved my issue. 解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM