+ Start a Discussion
PERFECTIONISTPERFECTIONIST 

Automatically Downloading attachments from opportunity

Hello All,

 

Good Time,

 

I would like to download attachments of Opportunity automatically, could you please suggest how do you want me to procced.

 

is there any tool which is avaliable in Appexchange.com or do i need to write SOQL if yes then could you please provide me some solution for this.

 

Thanks in advance

 

Perfectionist

Ashish_SFDCAshish_SFDC

HI Satish, 

 

This mostly depends on what tools/utilities you use to extract. The SOQL for Attachment sObject will always return one row at a time if Body field is included in the query. This is enforced to conserver resources and prevent overbearing SOQL scripts.

 

Approach #1, if queryMore is not available: Issue a SOQL without Body field to enumerate all attachments, then issue one SOQL per attachment ID to retrieve Body

Approach #2: Issue a SOQL to retrieve all needed attachments then loop using queryMore to get them one at a time.

Approach #3: If you can "freeze" the SF environment and just want to take snapshot of the system to pre-load a different one to be used going forward you can use "data exports". In setup menu, in data management there is an export data command, make sure you click "Include in export" to include all binary data. After due process it will give you a complete data backup you can crunch offline.

 

Btw, body is base64 encoded, you'll need to decode it to get the actual binary

http://stackoverflow.com/questions/5865736/how-can-i-extract-attachments-from-salesforce

 

 

PERFECTIONISTPERFECTIONIST

Hello Ashi,

 

Thanks for your reply.

 

i tried to download attachements while using Fileexporter tool, and exported attachments folder has been creatd along with Base64. file type. could you please let me know how do we download original file attachments.

 

and also am finding below error while running the vbs files

-----------------------------------------

Step3cv-ReadVersion
Data.vbs
Line: 26
Char: 2
Error: File no found
code: 800A0035
Source: Microsoft VBScript runtime error

-------------------------------------------------

Step3d-ReadBody.vbs
Line: 26
Char: 2
Error: File not found
Code: 800A0035
Source: Microsoft VBScript runtime error

--------------------------------------------------------

 

please let us know if you need more details.

 

 

Thanks,

Sathish R

 

Arunkumar.RArunkumar.R

Here is the way to view all your attachment through soql... 

 

 

When u click view in visualforce page you can download your attachment... 

 

 

http://salesforcekings.blogspot.in/2013/11/view-all-your-attachment-in-visualforce.html

 

If you found this answer helpful to you... Please accept this as a Solution and  give kudos by clicking on the star icon.

 

Thanks and Regards,

Arunkumar.R | Salesforce Certified Developer

Ashish_SFDCAshish_SFDC
Ashish_SFDCAshish_SFDC

Hi Satish, 

 

 

Please see the links for the VB Error, 

 

http://support.microsoft.com/kb/276011

 

http://www.computerperformance.co.uk/Logon/code/code_800A0035.htm

 

 

Regards,

Ashish

PERFECTIONISTPERFECTIONIST

Thanks ashish,

 

i will make the neccessary changes

 

Ashish_SFDCAshish_SFDC

Hi Satish, 

 

The blog is Written by Arun Kumar who has posted this code for us.

 

Regards,

Ashish

PERFECTIONISTPERFECTIONIST
Hello Arun

Thanks for replying for my query.
i have gone through the below blog and could able to see all the attachemnts in single page as of now its great but is there any possibility to download in particular page...could you please help me out

http://salesforcekings.blogspot.in/2013/11/view-all-your-attachment-in-visualforce.html

appreciate your help.

Thanks & Regards,
Sathish R
Sonam MeshramSonam Meshram
Hello all,

I came across the newly developed app in AppExchange where you can download almost any Attachment or File under one or multiple records all at once.

They do support download of Static Resource & Documents, email messages too.

Please have a look: https://sforce.co/34thF8U