Practice Task

Apex Projects(Scenario Based)

1. Auto-Assign Account Owner Based on Region

Objective: When a new Account is created, automatically assign an owner based on the region field.

2. Lead Auto-Conversion

Objective: Automatically convert a Lead into an Account, Contact, and Opportunity when a checkbox (Auto_Convert__c) is checked.

3. Task Reminder Trigger

Objective: Create a task reminder when an Opportunity’s stage changes to “Negotiation/Review”.

4. Email Notification on High-Value Opportunity

Objective: Send an email alert if an Opportunity is created with Amount > $50,000.

5. Contact Count on Account

Objective: Keep a custom field Contact_Count__c on Account updated whenever related Contacts are added or deleted.

6. Simple Apex REST API

Objective: Create a custom Apex REST API that returns Account details by name.

7. Visualforce Page to Display Opportunities

Objective: Create a VF page that lists all Opportunities related to an Account with filtering options

8. Prevent Frequent Account Updates

Objective: Prevent users from updating an Account record more than once within a 1-hour period by tracking the last update timestamp.

9. Batch Completion Email Notification

Objective: Send an email to the client upon batch completion, showing the count of records successfully updated and those that failed.

10. Auto-Close Opportunities from Account Checkbox

Objective: Automatically close all open Opportunities as “Closed Won” when the Close_all_Opps__c checkbox is checked on an Account.

11. Mark Recent Accounts as Updated

Objective: Append “- Updated” to the name of all Accounts created in the last 30 days to easily identify recently added records.

12. Batch Delete Closed Cases

Objective: Delete all Case records where the status is “Closed”, the closed reason is “No Action Needed”, and the closed date is within the last 50 days.

13. Auto-Close Expired Opportunities

Objective: Update the stage of Opportunities to “Closed Lost” if their close date is in the past and they are not already closed.

14. Auto-Rate Accounts Based on Revenue

Objective: Automatically set the Account’s Rating field based on AnnualRevenue:

• 1M → ‘Hot’

• 500K–1M → ‘Warm’

• < 500K → ‘Cold’

15. Prevent More Than Two Contacts Per Account

Objective: Block the insertion of a new Contact if the related Account already has more than 2 existing Contacts.

16. Prevent Duplicate Email Contacts Under Same Account

Objective: Prevent inserting a Contact if another Contact with the same Email already exists under the same Account.

17. Sync Project Status to Account

Objective: When a Project__c record is updated, automatically sync its Project_Status__c field to the related Account’s Current_Project_Status__c field.