Skip to main content

@Vignex provided this answer

Trigger UpdateLEStatus on Case (after insert) { Set UpdatedAccountIds = new Set();

Id recordTypeId = Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer Save').RecordTypeId;

for (Case c: Trigger.new) { if (c.RecordTypeId == recordTypeId) { UpdatedAccountIds.add(c.accountid); }
} List AccountForUpdating = [SELECT LE_Status__c FROM Account WHERE Id IN: UpdatedAccountIds]; for (Account item: AccountForUpdating) { item.LE_Status__c = 'Red'; item.LE_Status_Notes__c = 'Customer Save Case'; } update AccountForUpdating; }

Trigger UpdateLEStatus on Case (after insert) { Set<id> UpdatedAccountIds =    new Set<id>();

    Id recordTypeId =Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer Save').RecordTypeId;

for (Case c: Trigger.new) {
    if (c.RecordTypeId == recordTypeId) {
        UpdatedAccountIds.add(c.accountid);
    }    
}
List<Account> AccountForUpdating = [SELECT LE_Status__c FROM Account WHERE Id IN: UpdatedAccountIds];
for (Account item: AccountForUpdating) {
    item.LE_Status__c = 'Red';
    item.LE_Status_Notes__c = 'Customer Save Case';
}
update AccountForUpdating;
}

@Vignex provided this answer

Trigger UpdateLEStatus on Case (after insert) { Set UpdatedAccountIds = new Set();

Id recordTypeId = Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer Save').RecordTypeId;

for (Case c: Trigger.new) { if (c.RecordTypeId == recordTypeId) { UpdatedAccountIds.add(c.accountid); }
} List AccountForUpdating = [SELECT LE_Status__c FROM Account WHERE Id IN: UpdatedAccountIds]; for (Account item: AccountForUpdating) { item.LE_Status__c = 'Red'; item.LE_Status_Notes__c = 'Customer Save Case'; } update AccountForUpdating; }

@Vignex provided this answer

Trigger UpdateLEStatus on Case (after insert) { Set<id> UpdatedAccountIds =    new Set<id>();

    Id recordTypeId =Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer Save').RecordTypeId;

for (Case c: Trigger.new) {
    if (c.RecordTypeId == recordTypeId) {
        UpdatedAccountIds.add(c.accountid);
    }    
}
List<Account> AccountForUpdating = [SELECT LE_Status__c FROM Account WHERE Id IN: UpdatedAccountIds];
for (Account item: AccountForUpdating) {
    item.LE_Status__c = 'Red';
    item.LE_Status_Notes__c = 'Customer Save Case';
}
update AccountForUpdating;
}
Source Link

@Vignex provided this answer

Trigger UpdateLEStatus on Case (after insert) { Set UpdatedAccountIds = new Set();

Id recordTypeId = Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer Save').RecordTypeId;

for (Case c: Trigger.new) { if (c.RecordTypeId == recordTypeId) { UpdatedAccountIds.add(c.accountid); }
} List AccountForUpdating = [SELECT LE_Status__c FROM Account WHERE Id IN: UpdatedAccountIds]; for (Account item: AccountForUpdating) { item.LE_Status__c = 'Red'; item.LE_Status_Notes__c = 'Customer Save Case'; } update AccountForUpdating; }