Frage

I am getting error "unexpected token List " while compiling the following code

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; 
    }
}
War es hilfreich?

Lösung

Judging by the rest of the code, it looks like you're missing an opening brace ({) after this line:

if (vLead.RecordTypeId == vRecordTypeId && vLead.IsConverted == true)

The closing brace immediately after the if closes the function (since there was no block opened for the if), causing the List line to be in an invalid context.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top