function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Justin PorterJustin Porter 

Designated Attachments

Hey all - Question about the best way of going about a project. While this could be, and will be used anywhere, I'll explain it using contracts.

So, a contract record is created with information, sent to our legal team, and returned with a contract to execute (in attachments). Through non-technology methods, the contract is sent to the client, returned for counter-sign by our execs, then uploaded (in attachments) and changed to executed. 

Since there are 2 set attachments that have to be uploaded, I wanted to be able to send the recordID for the specific attachment to a field. So one field would be "Original Contract", which would include the recordID for the respected attachment, and "Executed Contract", which would be the recordID for that.

Obviously the end user wouldn't be putting these IDs in, as I would want it to be automatic. I'm thinking I'd need to do this via VF and Apex, and was wondering if anyone could provide some recommendations and ideas - as well as pointing me in the right direction as far as resources/blogs/documentation. I'm new to the apex/VF arena. 

Thank you!
Sagar PareekSagar Pareek
If I understood your requirement you are asking like this -

You have one contract record with two attachments-
1st prepared by legal that you call contract to execute.
2nd sent by client once they signed it.


Both of these will be received using email.


So technically speaking 
1. We have a record called contract ( considering it as salesforce custom object)
2. We will attach two attachment records to this record ( attachment is standard object in salesforce)

This can be done using InboundEmail class in salesforce -
https://help.salesforce.com/HTViewHelpDoc?id=code_inbound_email.htm&language=en_US

Now at one point i am not is that will you be sending the intial draft using email? If yes then you will need to use -
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_sending_attachments.htm

Hope this will help you! 

 
Justin PorterJustin Porter
Hi Sagar, thanks for your reply. I actually don't want anything to occur via email with SF - it will be manual. What I'm seeing is an upload button for the original contract - that when uploaded, the attachmentID will go into the field so when clicked, that attachment will show.
Same for "Executed Contract".