Apex如果条件

时间:2016-02-13 01:29:28

标签: salesforce apex

我收到错误条件表达式必须是布尔类型。

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 

        }

1 个答案:

答案 0 :(得分:0)

if(pos.RecordTypeId == [SELECT Id  from RecordType WHERE sObjectType = 'Account' AND IsActive = True AND Name = 'Health Care' LIMIT 1].Id)

使用双==代替上述内容。