DocSF

DocSF

Did You Know?

You can create any type of product documentation with Docy

Salesforce Trigger Update

trigger OnCustobjCaseFields on Customobj__c (after insert, after update)
{
    map<string, Customobj__c> ObjMap = new map<string, Customobj__c>();
    
    for(Customobj__c obj: Trigger.new)
    {
        if (obj.Shared_Field__c != Null)
        {
            ObjMap.put(obj.Shared_Field__c, obj);
        }
    }
    
    List<Case> cases = [SELECT Id, Shared_Field__c, AccountId, Expected_Event_Types__c 
    					FROM Case WHERE Shared_Field__c IN :ObjMap.KeySet()];
    List<Case> caseUpdateList = new List<Case>();
    
    for(Case c: cases)
    {
    	Customobj__c obj = ObjMap.get(c.Shared_Field__c);
        c.AccountId = obj.Account__c;
        c.App__c = obj.Id;
        c.Expected_Event_Types__c = obj.Event_Types__c;
        caseUpdateList.add(c);
    }
    
    if(caseUpdateList.size() > 0)
    {
        update caseUpdateList;
    }
}

Related Post

Salesforce unit test inserimento record

In basso un esempio di unit test su una classe che ins...

Come funzionano i Lightning Web Component o L

Appunti che descrivono cosa sono gli LWC e come funzioa...

Retrive custom label da Visual studio

<types>         <members>*</members> ...