Câu 3: Certified Platform Developer II
trigger AssignOwnerByRegion on Account ( before insert, before update ){List accountList = new List ();for( Account anAccount : trigger.new ){Region__c theRegion = [SELECT Id, Name, Region_Manager__cFROM Region__c -WHERE Name = :anAccount.Region_Name__c];anAccount.OwnerId = theRegion.Region_Manager__c;accountList.add(…
Nội dung câu hỏi
trigger AssignOwnerByRegion on Account ( before insert, before update ){List accountList = new List ();for( Account anAccount : trigger.new ){Region__c theRegion = [SELECT Id, Name, Region_Manager__cFROM 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.)
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. Use a Map to cache the results of the Region__c query by Id.
- B. Move the Region__c query to outside the loop. — đáp án hiện tại
- C. Remove the last line updating accountList as it is not needed. — đáp án hiện tại
- D. Use a Map accountMap instead of List accountList.
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.