Apex if 条件
Apex if Condition
我收到错误条件表达式必须是布尔类型。
for (Account acc: trigger.new)
{
if(acc.RecordTypeId = [SELECT Id from RecordType WHERE sObjectType = 'Account' AND IsActive = True AND Name = 'Health Care' LIMIT 1].Id)
{
//some code
}
if(pos.RecordTypeId == [SELECT Id from RecordType WHERE sObjectType = 'Account' AND IsActive = True AND Name = 'Health Care' LIMIT 1].Id)
如上所示使用双 ==
。
我收到错误条件表达式必须是布尔类型。
for (Account acc: trigger.new)
{
if(acc.RecordTypeId = [SELECT Id from RecordType WHERE sObjectType = 'Account' AND IsActive = True AND Name = 'Health Care' LIMIT 1].Id)
{
//some code
}
if(pos.RecordTypeId == [SELECT Id from RecordType WHERE sObjectType = 'Account' AND IsActive = True AND Name = 'Health Care' LIMIT 1].Id)
如上所示使用双 ==
。