Ability to customize file name in PDF Templates

Comments

14 comments

  • Kris Bachmann

    We need to be able to have this modified or we will not be able to use the functionality, the invoice attachment needs indicate our company and at lease the invoice number, which in our case is the proprietary billing number. Please contact me if this cant be done as I am sure we are not the only client that would want or need this option.

    Kris Bachmann, CFO Nardello & Co direct # 212-537-5339

     

    0
    Comment actions Permalink
  • Ryan Faulkingham

    Hi Chad and Kris,

    Thank you for your feedback. I am submitting a ticket to our team as a product enhancement. Currently, after the attachment is saved, it can be edited with an updated name. 

    Thank you,

    Ryan

    0
    Comment actions Permalink
  • Eric Bicknese

    I agree with the above comments, and would also add the the PDF's need to be saved via the Content_Document API (Files) and not attachments. This follows the Salesforce migration away from attachments to Files. The functionality would apply to both the Billing and Purchase Order objects & list views.

    0
    Comment actions Permalink
  • Ryan Faulkingham

    Hi Eric,

    Our next release (Echinacea) will follow salesforce's lead and save to the files related list. 

    Thank you,

    Ryan

    0
    Comment actions Permalink
  • Rusty Mitchener

    Has any work been done on the ability to change the file name of a Billing PDF?

    1
    Comment actions Permalink
  • Rebecca Ralls

    Yes - it's been updated in Iris: https://support.accountingseed.com/hc/en-us/articles/360043426813#PDFFile

    -1
    Comment actions Permalink
  • Antonia Nuzzolo

    Rebecca's link leads to nowhere.

    I still am looking for an answer on this. I've been glossing through the AccountingSeed classes in our Dev Console and keep hitting dead ends. The command button "Save PDF" uses the action="{!saveAttach}" which I can't find anywhere... I have to figure this out or AccountingSeed is going to fail for our company

    0
    Comment actions Permalink
  • Rebecca Ralls

    The Iris release notes were moved:

    https://support.accountingseed.com/hc/article_attachments/6367640182419/Iris_Release_Notes.pdf

    But what is it that you are trying to do, Antonia?  

    -1
    Comment actions Permalink
  • Antonia Nuzzolo

    I would like the invoice PDF names to be different. I am shooting the PDFs to an outside software and the name of the file has to be parsed to be filed appropriately. 

    0
    Comment actions Permalink
  • Bao Do

    I think I answered this question 8n one of your other posts. The pdf filename is hardcoded in their managed package. You can't change it unless they extend that ability.

    0
    Comment actions Permalink
  • Antonia Nuzzolo

    Woohoo! Look no further, I found the answer!!

    Copied and pasted from our savior, Tushar Saxena: https://salesforce.stackexchange.com/questions/317757/how-to-automatically-change-the-name-of-a-file-upon-creation

     

    I added this to my dev console and it works perfect. Just did some refining to be able to change "test-" to what I actually wanted (which isn't difficult, just a bit of SOQL)

     

    I tried the solution and created a trigger on ContentDocumentLink and it works. Like whenever I upload a file directly it changes the name with "test-"before the file name.

    Trigger on ContentDocumentLink

    trigger ContentDocumentLinkTrigger on ContentDocumentLink (after  insert) {
        
        if(trigger.isAfter && trigger.isInsert) {    
            ContentDocumentLinkTriggerHandler.onAfterInsert(trigger.new);
        }
        
    }
    

    Handler Code-

    public class ContentDocumentLinkTriggerHandler {
        public static void onAfterInsert(list<ContentDocumentLink> contDocList) {
            
            Set<Id> contDocId = new set<Id>();
            set<Id> accIds = new set<Id>();
            
            for(ContentDocumentLink cdl : contDocList) { 
                contDocId.add(cdl.ContentDocumentId);
            }
            
            map<Id, ContentDocument> mapContentDocuments = new map<Id, ContentDocument>([SELECT Id, Title, FileExtension FROM ContentDocument WHERE Id IN :contDocId]);
            
            list<ContentDocument> listUpdate = new list<ContentDocument>();
            
            for(ContentDocumentLink cdlIterator : contDocList) 
            {
                ContentDocument objCntDoc = mapContentDocuments.get(cdlIterator.ContentDocumentId);
                String strFilename = '';
                
                strFilename = 'test-' +objCntDoc.Title+'.'+ objCntDoc.FileExtension;
                if(!String.isBlank(strFilename)) {
                    objCntDoc.Title = strFilename;
                    listUpdate.add(objCntDoc);
                } 
            }
            if(!listUpdate.isEmpty()) {
                update listUpdate;
            }
            
        }
    }
    1
    Comment actions Permalink
  • Bao Do

    That is excellent! Thanks for sharing

    1
    Comment actions Permalink
  • Rebecca Ralls

    Nice find!  Thank you for sharing! 😅

    1
    Comment actions Permalink
  • Rebecca Ralls

    I guess you can't fire a flow on the ContentDocumentLink object ... yet 😜 

    0
    Comment actions Permalink

Please sign in to leave a comment.