Apex Flashcards
what is the transient keyword used for?
Use the transient keyword to declare instance variables that can’t be saved, and shouldn’t be transmitted as part of the view state for a Visualforce page.
True or False?
Declaring variables as transient reduces view state size?
True
Which of the following are true regarding custom setting data?
Choose 2
A. Custom setting data can be accessed by formula fields, validation rules, Apex and Visualforce pages
B. There are two types of custom setting data, hierarchy and list
C. Custom setting data needs to be queried once using SOQL and then it is stored in the chache
D. Custom setting data cannot be queried using SOQL
A. Custom setting data can be accessed by formula fields, validation rules, Apex and Visualforce pages
B. There are two types of custom setting data, hierarchy and list
Can before insert change fields using trigger.new?
Yes
Can after insert change fields using trigger.new?
Not allowed.
A runtime error is thrown.
Trigger.new is already saved
Can before update change fields using trigger.new?
Yes
Can after update change fields using trigger.new?
Not allowed.
A runtime error is thrown.
Trigger.new is already saved
Can before delete change fields in trigger.new?
Not allowed. A runtime error is thrown. trigger.new is not available in before delete triggers.
Can after delete change fields in trigger.new?
Not allowed. A runtime error is thrown. trigger.new is not available in after delete triggers.
Can after undelete change fields in trigger.new?
Not allowed. A runtime error is thrown.
Can before insert update original object using an update DML operation?
Not applicable. The original object has not been created; nothing can reference it, so nothing can update it.
Can after insert update original object using an update DML operation?
Yes
Can before update update original object using an update DML operation?
Not allowed. A runtime error is thrown.
Can after update update original object using an update DML operation?
Allowed. Even though bad code could cause an infinite recursion doing this incorrectly, the error would be found by the governor limits.
Can before delete update original object using an update DML operation?
Allowed. The updates are saved before the object is deleted, so if the object is undeleted, the updates become visible.
Can after delete update original object using an update DML operation?
Not applicable. The object has already been deleted.
Can after undelete update original object using an update DML operation?
Allowed
Can before insert delete original object using a delete DML operation
Not applicable. The original object has not been created; nothing can reference it, so nothing can update it.
Can after insert delete original object using a delete DML operation
Allowed, but unnecessary. The object is deleted immediately after being inserted.
Can before update delete original object using a delete DML operation
Not allowed. A runtime error is thrown.
Can after update delete original object using a delete DML operation
Allowed. The updates are saved before the object is deleted, so if the object is undeleted, the updates become visible.
Can before delete delete original object using a delete DML operation
Not allowed. A runtime error is thrown. The deletion is already in progress.
Can after delete delete original object using a delete DML operation
Not applicable. The object has already been deleted.