Apex and Visualforce Controllers: Trigger Context Variable That Cannot be Deleted

Which Trigger Context Variable Cannot be Deleted?

Question

Which trigger context variable cannot be deleted?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D.

The trigger context variable that cannot be deleted is Trigger.new.

In Salesforce, triggers are used to execute specific actions before or after a record is inserted, updated, or deleted in the database. The trigger context variable provides information about the current trigger execution context, including the records that are being modified.

The Trigger.new context variable is a read-only list that contains all the new versions of the sObject records that are being inserted or updated in the database. This variable is used to access the new versions of the records and to perform any necessary validation or manipulation before they are saved.

The other options in the question are not trigger context variables.

  • RETURNING is not a trigger context variable. It is a SQL clause used in SOQL to specify the fields to return in a query result.

  • on-demand is not a trigger context variable. It refers to the execution of code only when it is explicitly called, rather than automatically by a trigger.

  • Exceptions are not trigger context variables. They are errors that occur during the execution of code and are caught by a try-catch block.

In conclusion, the correct answer to the question is D. Trigger.new is the trigger context variable that cannot be deleted.