if(productSet!=null || productSet!='')
{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'The selected product set is available in the system. Please close the window & click on ‘Select saved Item List’ button to select this product set.');
ApexPages.addMessage(myMsg);
return null;
}发布于 2014-08-01 18:14:41
productSet的类型为LIST<CRG_Product_Set__c>。在if条件的第二部分,您将检查这是否与空字符串不相等。
将对象列表与字符串进行比较是没有意义的。
我怀疑您正在尝试检查列表是否为空并显示一条错误消息。尝试如下所示:
if(productSet == null || productSet.size() == 0)
{
//...
}这并不是说我取消了比较操作,以便在列表为null或为空时显示消息。
https://stackoverflow.com/questions/25037948
复制相似问题