A construction company uses Salesforce Sales Cloud to manage contracts with clients. The company has annual contracts with its clients and plans to automate the renewal process by sending an email reminder four weeks in advance of the renewal date.
The Salesforce team has decided to use apex to automate this process. They have tasked you with implementing a function that calculates the renewal notice date based on the contract's start date.
Complete the given Apex method to return the renewal notice date based on the provided start date.
Instructions :
1. The method should accept one parameter, the contract's start date of type 'Date'.
2. The contract end date is twelve months from the start date.
3. Determine the renewal notice date, which is four weeks (28 days) before the contract end date.
4. The method should return the renewal notice date calculated in step 3.
Example:
//Assume given start date is 01-01-2024 (mm-dd-yyyy).
Date renewalNoticeDate = contractController.findRenewalNoticeDate(Date startDate);
//Result
//The renewal notice date is 12-04-2024 (mm-dd-yyyy)
Hint:
Use apex date methods to determine the renewal date date.
Click here to view all apex date practice examples