1. In Salesforce, what is the purpose of a trigger?
- A) To create custom objects
- B) To automate business processes based on data changes
- C) To generate reports and dashboards
- D) To define field-level security
2. Which type of triggers are supported in Salesforce?
- A) Apex Triggers
- B) Workflow Triggers
- C) Process Builder Triggers
- D) Visualforce Triggers
3. What is the syntax for creating an Apex Trigger in Salesforce?
- A)
trigger MyTrigger on ObjectName (before insert) { ... }
- B)
apex trigger MyTrigger for ObjectName (before insert) { ... }
- C)
class MyTrigger extends Trigger { ... }
- D)
create trigger MyTrigger on ObjectName (before insert) { ... }
- A)
4. In Salesforce triggers, when does a "before" trigger fire?
- A) After the record is inserted or updated
- B) Before the record is inserted or updated
- C) After the record is deleted
- D) Before the record is deleted
5. What is the purpose of a "after insert" trigger in Salesforce?
- A) To perform actions after a record is inserted
- B) To prevent the insertion of records
- C) To roll back a transaction if conditions are not met
- D) To execute before a record is inserted
6. Which Salesforce object can Apex Triggers be defined on?
- A) User
- B) Profile
- C) Custom Object
- D) Permission Set
7. What is the purpose of the
Trigger.new
context variable in Apex Triggers?- A) It stores the old values of the records being updated.
- B) It provides the new values of the records being inserted or updated.
- C) It contains the records being deleted.
- D) It is used to define trigger conditions.
8. In Salesforce, what is the difference between a "before insert" and an "after insert" trigger?
- A) "Before insert" triggers execute after records are inserted, while "after insert" triggers execute before records are inserted.
- B) "Before insert" triggers execute before records are inserted, while "after insert" triggers execute after records are inserted.
- C) There is no difference between the two; they can be used interchangeably.
- D) "Before insert" triggers only apply to custom objects, while "after insert" triggers apply to standard objects.
9. What is the purpose of the
Trigger.oldMap
context variable in Salesforce triggers?- A) It stores the old values of records being updated.
- B) It provides the new values of records being inserted or updated.
- C) It contains the records being deleted.
- D) It is used to define trigger conditions.
10.In Salesforce triggers, what is the purpose of the
isUpdate
context variable?- A) To check if a record is being updated
- B) To determine if a trigger is in update context
- C) To identify if an update operation is in progress
- D) To indicate if an update trigger has fired
Answer Key :
1. In Salesforce, what is the purpose of a trigger?
- Answer: B) To automate business processes based on data changes
2. Which type of triggers are supported in Salesforce?
- Answer: A) Apex Triggers
3. What is the syntax for creating an Apex Trigger in Salesforce?
- Answer: A)
trigger MyTrigger on ObjectName (before insert) { ... }
- Answer: A)
4. In Salesforce triggers, when does a "before" trigger fire?
- Answer: B) Before the record is inserted or updated
5. What is the purpose of a "after insert" trigger in Salesforce?
- Answer: A) To perform actions after a record is inserted
6. Which Salesforce object can Apex Triggers be defined on?
- Answer: C) Custom Object
7. What is the purpose of the
Trigger.new
context variable in Apex Triggers?- Answer: B) It provides the new values of the records being inserted or updated.
8. In Salesforce, what is the difference between a "before insert" and an "after insert" trigger?
- Answer: B) "Before insert" triggers execute before records are inserted, while "after insert" triggers execute after records are inserted.
9. What is the purpose of the
Trigger.oldMap
context variable in Salesforce triggers?- Answer: A) It stores the old values of records being updated.
10. In Salesforce triggers, what is the purpose of the
isUpdate
context variable?- Answer: A) To check if a record is being updated
0 Comments
Post a Comment