Under review

Automatically fill custom fields' values when adding/copying a file

alx.gambier 11 months ago in Feature requests updated 11 months ago 4

Hi there,

I've added a custom field set with some fields inside.

When adding/copying a file I would like to automatically set some this fields to specific values.

For example in the 'Automatic source' parameter we could enter an URL to a php function that will return the value when adding/copying the file.

Thanks for your reply


Under review


Please do give an example of a practical use for this, as we tend not to add features that can only serve a very limited number of cases, or very specific cases.


I will to use FileRun as a typical file sharing drive but also as a light DMS (Document Management System).

So I need my documents to be associated with a unique number formatted according to my needs.

That why I've added a field named 'Document Number'. This document number must be unique and is not a simple incremented counter but it's generated according to the local date/time.

This document number is visible on the document when it gets printed so I can easily research it using the FileRun search function.

For now I have to enter this value by typing it but it will be very convenient if it could be automatically generated.

FileRun can not handle every kind of value that may be automatically generated (each user has specific needs). That's why it would be convenient if we could enter the name of a PHP function, shell script or whatever is practical for the dev team. This function would be created by the end user and called by FileRun when a file is inserted or copied.

I was thinking of adding this in the Automatic Source parameter. See below.

dms.php would be a PHP file I would create and that would include all the functions I need.

Another way to do it. Would be to implement a custom event system where users could create hook functions for specific events. Let's say I define a function I associate to the "File uploaded' event.

Like it's possible to define notification rules but this time with events associated to hook functions.

Hope I made myself clearer.


Thanks for the details. We'll look into the possibility of having custom PHP code ran for automatic metadata.

Another way to do it. Would be to implement a custom event system where users could create hook functions for specific events.

That is already in place: https://docs.filerun.com/custom_event_scripts

I might be able to come back at a later time with sample code for achieving the above using this method.

Thanks !

I'll have a look to the custom event scripts.