A retail shop uses salesforce to track their sales, service offers a hassle-free return policy. Customers have 30 days to return any unworn or unopened item in its original condition for a full refund if you're not completely satisfied. They need to develop apex code for order return eligibility checks.
The shop uses salesforce to manage customer orders, and each purchase is recorded as a salesforce order with sold date stamped on effective date.
Instructions:
The provided apex method takes the order number as input. Complete the apex code find the corresponding order.
1. If the order's effective date is within the last 30 days, return true.
2. If the order's effective date is not within the last 30 days, return false.
Sample order
Order field | Value | Description |
---|---|---|
Order Number | 987450 | Order # |
Sold date | 10/10/2020 | Item sold date |
Today's date : 20/10/2020
Example
Boolean canAcceptReturn = OrderReturnController.checkOrderWithin30Days('987450')
// Expected result: true
Note: This exercise will guide you through creating a basic apex method that queries salesforce orders and determines if they were placed within the last 30 days. Utilize apex date methods to determine if the sold date of the provided order falls within the last 30 days.