trigger AssignOwnerByRegion on Account ( before insert, before update )
{
List<Account> accountList = new List<Account>();
for( Account anAccount : trigger.new )
{
Region__c theRegion = [
SELECT Id, Name, Region_Manager__c
FROM Region__c -
WHERE Name = :anAccount.Region_Name__c
];
anAccount.OwnerId = theRegion.Region_Manager__c;
accountList.add( anAccount );
}
update accountList;
}
Consider the above trigger intended to assign the Account to the manager of the Account's region.
Which two changes should a developer make in this trigger to adhere to best practices? (Choose two.)
sajjankrgupta
Highly Voted 3 years, 11 months agoAB1993
Highly Voted 3 years, 3 months agoJeet89123
Most Recent 5 months, 2 weeks agoMetaLojiqTee
1 year, 3 months agoram12313
1 year, 7 months agoGenki_Sugisaki
1 year, 8 months agoamilaveer
1 year, 11 months agosf2022
1 year, 11 months agoDean5555
2 years, 1 month agolevian
2 years, 1 month agoPratibhadx
3 years, 1 month agoamerbearat
3 years, 3 months ago