Ability to customize file name in PDF Templates
The standard send / save PDF functionality provides a hardcoded and sub-optimal name that doesn't even include the billing number. It is something like Billing PDF [Date]. It would be nice to support some variations some you can output something like "Company Name Invoice #12345678"
-
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
-
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.
-
Yes - it's been updated in Iris: https://support.accountingseed.com/hc/en-us/articles/360043426813#PDFFile
-
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
-
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?
-
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; } } }
Please sign in to leave a comment.
Comments
14 comments