Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m sad

How to modify/customize the SF_DownloadBlobs procedure to use Name column value as file name from Attachment object?

Attachment object has Name column with values as "FileName.extension type", So
How to modify/customize the SF_DownloadBlobs procedure to use Name column value as file name.extension type while creating corresponding files in file system?
1 person has
this problem
+1
Reply
  • The current naming convention was chosen because it matches the naming convention used by the weekly export service of salesforce.

    You might be able to write a C# program that read the file name with the Id and then connected to SQL Server and did a SELECT against the attachment table with that ID to fetch the name. Finally, your C# program could rename the file in the directory.

    Be aware that the filenames are not unique and that your program may encounter multiple attachments with the same name.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Thanks for the quick turn around Bill. The main issue is that , it's extension. Right now extracted files are with ".File" extension type, so it's difficult for the end users to use it directly. Atleast it should have been with proper extension.
    I've looked at the code behind this procedure (it was actually a set of DBAmp commands which does the extract) and from your response, I understood that "We can't customize the stored procedure SF_DownloadBlobs".
    Since it's a paid version, can we get the technical assistance from DBAmp to customize/create new stored procedure for our requirement. If not, any third party tools and ready made code which solves this issue.

    Thanks.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • The stored procedure is really just a shell to call a C# program that does the work. Therefore modifying the stored procedure will not get you much.

    The suggestion I outlined above will work for the extension as well. Please consider this our technical assistance on how to accomplish the task. You will have to provide or locate the C# skills needed to write the program.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • I know this thread is a year old, but here's a good workaround that uses the tools we all should be good at: Assuming you can/have used SF_Replicate or SF_BulkSOQL to get the Attachment metadata (in addition to the Blobs)... Write a SQL script that selects from the metadata table and writes a DOS batch file to do the file renames. You know the blob filename is [blob_folder]\[attachmentid]_body.file -- so you can do this:
    SELECT 'rename "c:\my_blob_folder\' + a.Id + '_body.file" "c:\my_goodname_folder\' + a.Name + '"' + CHAR(10)
    FROM Attachment_metatable as a
    WHERE left(a.ParentId,3) = '001' --get all id's for attachments tied to Accounts

    Copy the output from that Select statement into notepad, and save it with a ".bat" extension, and then run it.

    Alternatively, you could write a T-Sql cursor and loop to dynamically generate the windows command above, plus wrap it in an "exec xp_cmdshell" call.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Thanks Herb. The Appirio guys are experts with DBAmp ; please keep them in mind for any DBAmp professional services.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned