企業のサポート プロセスでは、ケースが「解決できました」ステータスでクローズされるたびに、Engineering Review カスタム オブジェクト レコードを作成し、ケース、連絡先、および関連する製品からの情報を入力する必要があると規定しています。場合。
Apex トリガを使用してこれを自動化する正しい方法は何ですか?
正解:A
The correct way to automate this using an Apex trigger is to create an after update trigger on Case that creates the Engineering Review record and inserts it. An after update trigger is a trigger that runs after a record is updated, and it can access the old and the new values of the record. The developer can use an after update trigger on Case to check if the status of the Case is changed to "Could not fix", and then create a new Engineering Review record and populate it with the information from the Case, the Contact, and any of the Products associated with the Case. The developer can then insert the Engineering Review record into the database. An after insert trigger on Case will not work, as it will run after a record is inserted, not updated, and it will not capture the change in the status of the Case. A before update trigger on Case will not work, as it will run before a record is updated, and it will not be able to insert the Engineering Review record into the database, as it will cause a mixed DML operation error. A before insert trigger on Case will not work, as it will run before a record is inserted, not updated, and it will not capture the change in the status of the Case. Reference: [Apex Triggers], [Apex Developer Guide]