Activity Forums Salesforce® Discussions How do we create a trigger handler in Salesforce?

  • Aditya

    Member
    May 15, 2020 at 3:44 pm

    Hi,
    trigger CaseLegalUpdate on Legal_Description__c (after insert, after update) {
    List<Id> legalId = new List<Id>();
    for(Legal_Description__c lg : Trigger.new)
    {
    if(lg.Case__c!=NULL)
    {
    legalId.add(lg.Case__c);
    }
    }
    List<Case> caseRecord = new List<Case>();
    if(legalId!=NULL && legalId.size()>0)
    {
    for(Case c:[SELECT id,Check_Legal_Description__c,RecordType.Name FROM Case WHERE id IN:legalId])
    {
    c.Check_Legal_Description__c=true;
    caseRecord.add(c);
    }
    update caseRecord;
    }
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos