Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

So I was wondering how I can attach a file to an account. Basically what we do is sell a product online that requires an agreement. When they buy the product, we generate a pdf of the agreement and mail it to them. What I would like to do is upload the pdf agreement and attach it to the corresponding opportunity or account. I am pretty sure this can be accomplished, but I don't see much documentation on it. I am using php and the API to create everything. Any one have any ideas?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

You can just create an Attachment on the Account. It should work the same way as creating an object in Salesforce.

Some important considerations:

  • The API sends and receives the binary file attachment data encoded as a base64Binary data type. Prior to creating a record, client applications must encode the binary attachment data as base64. Upon receiving a response, client applications must decode the base64 data to binary (this conversion is usually handled for you by the SOAP client).

  • The create call restricts these files to a maximum size of 5 MB. For a file attached to a Solution, the limit is 1.5MB. The maximum email attachment size is 3 MB.

share|improve this answer
1  
This worked perfectly for what I was trying to achieve. Thanks for the advice! –  jeffro25 Feb 6 '13 at 15:26

I would recommend using chatter files related to the record rather than attachments as chatter files have a number of features that attachments lack.

To upload a file and relate it to a record you use a feeditem with the following required fields.

ContentData: base64 encoded file
ContentFileName: file name
ParentId: account/opportunity ID
Type: 'ContentPost'
share|improve this answer

I would like to recommend ready to use Salesforce Appexchange Native App Cloud Drop in order to store any number and size of files that can be associated with any salesforce object. Cloud Drop is one of a smart and excellent native app available which integrated Salesforce with Rackspace. Please check the following link for more information:

https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003IzEDEA0

Thanks Anchal Garg

share|improve this answer
    
Can you explain the benefits of this over the default attachements, and how this can be API integrated ? Else this is pretty much advertising which usually gets removed. –  Samuel De Rycke Feb 24 at 11:27
    
Samuel ,As you know their are several limitation of salesforce default attachment : 1. Max size of attachment that can be associated with a particular sfdc record is 5 MB 2. Also the size of the uploaded file count against the salesforce file storage space (which seems to be costly if user needs to attach large no. of file.) So, A good solution for this issue would be use third party api(Rest) for saving file content there and making a record for that in salesforce for fetching the content of file .CloudDrop app is using same logic for uploading and downloading of the file to Rackspace server. –  Anchal Garg Feb 26 at 5:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.