With inriver being event-driven we can in code detect that a file has been uploaded and perform actions based on:
- The filename
- The file content
- The user and their role(s) that uploaded the file
This means that we can be creative and do a lot of neat things! Below I’ll list a couple of use cases we’ve done for customers or that’s possible by acting on an uploaded file, this of course require coding by your inriver partner. They are in no specific order but I’ll list them with numbers in case you want to reference one of them.
- I feel like I have to mention the obligatory automatically-link-to-the-relevant-entity-using-an-identifier-in-the-file-name, but that’s well known. For example linking an uploaded image to the correct item.
- Upload an Excel file and import to read-only or hidden fields, note that the updated fields will have ‘system’ as the user having performed the field update.
- Upload an Excel file and automatically create links. For example if you have a product id in one column and the item numbers in another, and use that to create the actual links.
- Upload an Excel file with item numbers that then creates a workarea with those items. Can of course be used for other entity types as well.
- Uploading a file and extracting data from it automatically if the files are always structured in a known format. Perhaps there’s a use case for an AI service here?
- Uploading an Excel file and perform certain logic before importing the data, for example transforming data, adding missing CVL values. The sky is the limit here and you can view this as a customizable extension to the standard inriver import. You could argue this is very similar to #2?
- Uploading a file and extracting metadata from the file. For example if you upload an image you can extract the image dimensions and other EXIF data, for documents the number of pages, etc.
We often use prefixes to know which “process” to use when uploading the file, for example for use case #2 you could run it for all files with the pattern “import_*.xlsx”, and alike.
What to do when things go wrong or to track the status then?
A neat solution is to create a task entity, link the uploaded file, assign it to the user that uploaded the file and write the error (or success) message in the task. You can also work with a status and message field on the resource itself if you don’t want to use tasks. You can also delete the uploaded resource entity and file if all went correctly and that would suit your processes best.
Lastly
Please if you have any other use cases list them in a comment below, this is a space for sharing all the wonderful knowledge and creative ideas we all have.
-
Nice tip! 🤩 Roy Eriksson
2 -
Very interesting, thanks!
Especially #6 sounds extremely interesting for us!
Do you have more information regarding how this would practically work?0 -
Your implementation partner would create an EntityListener that triggers on created Resource entities, they can then check the uploaded files name, content or in another way see if the file should be processed per your wanted logic or not, and then perform the logic in the entity listener if the uploaded file meets the criteria.
0 -
Thanks for the fast reaction!
And how would for example 'adding missing CVL values' work?
I assume this is only possible if there is a logic defined for filling these values?0 -
Hi,
Slower response this time. ;) In the same EntityListener they would check the data to be imported, and if you are trying to import a CVL value that don't exist today (which in the regular import would fail), you can in that logic create the missing CVL value and then import the data.
0
Please sign in to leave a comment.
Comments
5 comments