開発者は、連絡先用および調査応答 c と呼ばれるカスタム オブジェクト用にシステムに入力された電子メール アドレスが、ブロックされたドメインのリストに属していないことを確認する任務を負っています。 ブロックされたドメインのリストは、ユーザーによるメンテナンスを容易にするためにカスタム オブジェクトに保存されます。アンケートの応答 c オブジェクトは、カスタム Visualforce ページを介して設定されます。 これを実装する最適な方法は何ですか?
正解:B
The optimal way to implement this is to implement the logic in a helper class that is called by an Apex trigger on Contact and from the custom Visualforce page controller. This way, the developer can reuse the same logic for both the Contact and the Survey Response_c objects, and ensure that the validation is applied consistently and efficiently. The helper class can query the list of blocked domains from the custom object and compare them with the email addresses entered into the system, and throw an exception if a match is found. Implementing the logic in validation rules, in an Apex trigger and a Visualforce page controller separately, or in a Visualforce page controller and calling that method from an Apex trigger are not optimal, as they will result in code duplication, maintenance issues, or performance problems. Reference: [Apex Triggers], [Visualforce Controllers], [Apex Developer Guide]