我收到错误"意外的令牌列表"在编译以下代码时
trigger Lead_Casecloseafter on Lead (after update) {
// Collect ODST leads
id vRecordTypeId = [select Id from RecordType where name='ODST_Leads'];
set<id> vSetCaseId= new set<id>();
for (Lead vLead:trigger.new)
{
if (vLead.RecordTypeId == vRecordTypeId && vLead.IsConverted == true)
vSetCaseId.add (vLead.ODST_Case__c);
}
}
// Looking up associated Case
List <Case> vLstcase = new List ([select id,name,Case_Number__c,Status from ODST_Case__c where ID IN:vSetCaseId]);
for (Case vCase:vLstcase)
{
vCase.Status == 'Closed';
if(!vLstcase.isempty())
update vLstcase;
}
}
答案 0 :(得分:0)
根据其余代码判断,在此行之后,您似乎错过了一个大括号({
):
if (vLead.RecordTypeId == vRecordTypeId && vLead.IsConverted == true)
if
关闭函数后立即关闭括号(因为if
没有打开任何块),导致List
行处于无效的上下文中。