ABC Bank would like to maintain records of Loan in Salesforce org through a Custom object called "Loan". On detail standard page they want to have an embedded Custom Page which will provide the facility to upload multiple Loan documents as attachments with Description. Description should be save to Attachment. Please refer to the image below for what bank is exactly looking :
In addition to this, they also want to see the total attachment count on the detail standard page of Loan Object (Parent Object). Total attachment count should be updated on all DML events (after insert, after update, after delete, after undelete). Also please throw a error page message as per the below snapshot, when user directly click on the upload without choosing any file.
Apart from this, they also need a nightly batch that runs on daily basis at 10 PM which will send a reminder to email ids of loan records whose total attachment count is 0, means that there is no document uploaded on the loan registration record. So batch will iterate over all the records and check for the total attachment count and if it is 0 then a reminder mail will be trigger to email id available in that record. Also create a CheckBox field - called "Document Reminder Sent" on the Loan Object and set it to True/checked through batch when the reminder sent to the Email ID on Loan records whose documents are not available. Also total attachment count is read only on the detail standard page. Please be sure that User cannot edit the Total Attachment count on the detail page.
Important : Before start any work, please thoroughly review the requirement for the feasibility. To ensure best performance, the Code should be developed as per the Salesforce Governor limit.
Mandatory Requirements :
1. Code shall be commented sufficiently to provide a basic understanding of what is happening.
3. Please make sure a header section with simple notes shall be included in each Apex or VisualForce resource. This header section shows - the name of the company, developer, developed for which component for e.g VF Page for XYZ Controller etc., and the abstract detail of the functioning.
4. Code shall always be bulkified (if applicable - Mainly in-case of Trigger)
5. Provide Test Classes (if applicable) with at least 95% code coverage. Test class should follow the best practices as per the Salesforce standards.
6. Please make a Testing Doc to show all the requirement scenarios with the help of Screenshots.