Attached to this challenge is a slick node.js app which will sync attachments loaded in the Notes & Attachments list in Salesforce.com and load them into SpringCM using Heroku. We need to add support for pulling documents that were inserted directly into SpringCM back into Salesforce.
Make the Following enhancements to the Application.
- Add a new Field named "SpringCM Document Id" to the SpringCM Attachment Object.
- Add a Trigger to the SpringCM Attachment Object
- When a record is inserted into the SpringCM Attachments Object, we need to retrieve the Document from SpringCM based on the "SpringCM Document Id" and use the existing field "Object ID" as the new parent of the inserted attachment.
- When we have completed the download, we need to update the "Attachment Id" and "Object Type" fields of the SpringCM Attachment record and set "Upload details" to "Successfully downloaded Attachment from SpringCM"
- If there is an Error, we need to update the Status and Details fields to reflect what the error was.
- Add a new button named "Re-Download Attachment"
- If the download failed, clicking this button will attempt the download again and will refresh the field values with the correct current error details or the correct field values indicating successful download.
- This button should disregard records with the "Status" of "Completed".
- Update Attachment trigger to not re-upload the document that was just downloaded back to SpringCM.
The expected workflow is that when a Document is uploaded into SpringCM, a new record will be created in the SpringCM Attachment Object. We need to trigger on the that insertion and use the SpringCM API to download the document. To demonstrate this, we need to insert a document into SpringCM, then using that Document ID, insert a record into the SpringCM Attachment Object. This should trigger the call out to SpringCM and download the document into the Correct parent record without the document being re-uploaded into SpringCM.