Thursday, August 3, 2023

Automatically Remove Special Characters from Filename while Uploading Files in Salesforce

 As we all know that we can perform URL hack to download all files related to parent record from salesforce. We have observed that sometime downloaded file name is changed to contentversion recordId by salesforce instead of actual file name. 

It is my observation that if file name contains special characters, then when we perform download All, file name is changed to "068xxxxxxxxxxxxxx.pdf".

I have added 2 files to account record for reference:



Now I can generate download URL if I have contentversionId of these 2 files. In my case the download URL will be:

https://xxxx/sfc/servlet.shepherd/version/download/0680K00000kLSdbQAG/0680K00000kLSfwQAG

where xxxx is you org domain URL.

You can use below script to generate download all files URL if you know the parent record Id.


If I open this URL, I will zip file which will contain both files and when I will extract it, it will appear as shown below:


As my observation, if any special character is present in file name then salesforce changes the file name. If "-" character is present, then salesforce won't change file name.

For this kind of scenarios, I recommend to have script in place which will remove all special characters from file name whenever file is being uploaded. You can write trigger on contentVersion object to remove special characters from file name. Below is code snippet which can help:



Hope this will help!!!!



2 comments:

  1. GENUINE, FRESH & VERIFIED STUFF AVAILABLE
    USA UK CANADA FR RUS ITALY
    FRESH SPAMMED NOV-2023

    USA REAL DL SCAN FRONT BACK WITH SELFIE
    SSN DOB DL FULLZ
    DEAD FULLZ
    SIN DOB FULLZ CANADA
    BUSINESS EIN COMPANY FULLZ
    YOUNG AGE FULLZ
    FULLZ FOR SBA|PUA|UI|KYC|UBER|DOORDASH
    CC WITH CVV & BILLING ADDRESS
    DUMPS WITH PIN TRACK 101 & 202

    TOOLS & TUTORIALS AVAILABLE AS WELL
    SMTP|RDP|C-PANEL|WEB-MAILER
    BRUTES|SHELLS|AWS-MAILER
    OFFICE365 SMTP|LEADS|LOGINS

    CONTACT FOR ORDER & MORE INFO
    EMAIL = bigbull0334 @ onion mail. org
    ICQ = 752822040 | @killhacks
    TELEGRAM = @killhacks | @leadsupplier
    SKYPE|WICKR = @peeterhacks

    ReplyDelete
  2. Hey Guyz!!

    Spamming Tools Are Available Here.

    Some Tools like,
    `SMTP
    `RDP
    `cPanel Hosting
    `SMS Leads-Phone Number
    `Email Leads
    `Office 365 Email Leads
    `Bulk Phone Number
    `Residential Proxy
    `Email Extractor
    `Bank logs Of All countries
    `Fullz Debit/Credit Card

    And Other Spamming Tools And Scam Pages Are Also Available here.

    Hit Me For Quick Deal:
    ICQ/TG @cpanelmaster
    Visit My Site https://toolz.store

    Services Available 24/7
    Guidance Will be Provided

    Looking For Making A Great Business Together.

    Thank You!!!

    ReplyDelete