Document Creation

Is there any magic to deleting an “old” version of a file when using PDF generation (template & rule) ?

The checkbox option seems to do absolutely nothing for me and I get loads of duplicate files (with differing time stamps obviously)

As an aside … anyone know how to select a version of a file based on its date / time stamp ? Say I have a bunch of files all called the same thing with different dates and I want only the latest one …

Maybe im getting brain fade and its really obvious :wink:

or of course if I give them different filenames how I might choose the one that I want (still probably the latest date / time stamp).

Are you saving the PDF down a to-many relation path? If so you will always get a new file each time.

If you only ever want a single version of a PDF then it should be saved to a field in the base object itself (or down only to-one relation paths to a related record), such that you are always writing to the exact same record and field each time (and thus overwriting the previous file).

OK that’s great - I was beginning to think that might be the answer. Yes its a 1-to-many relationship so that explains it. I need it to be as such because it will need to store “lots” of documents per case potentially - this is just one type that I am particularly interesting in doing things with …

I don’t have an issue with versions of a document provided I can find a way to select the latest 1 by time stamp (in this case for emailing out). Feels like some combination of subset and/or composite might make that possible.

I guess I could resort to some form of record selector in the code studio if necessary.

A couple of options…

You could have separate File fields (or one-to-one relationships) for any specific documents you need to do anything special with, and then keep the one-to many for any other misc docs. This will make rules for specific docs a lot easier.

Yes you could use a record selector to find a specific file from the list of documents and maybe create a separate one-to-one relationship to it, which you can then use for messaging etc. This gets more complicated if the to-many documents relationship contains many different types of doc as opposed to just versions of one, as you might need to then filter by filename or similar as well as date.

There are probably many other options too depending on exact needs.

1 Like