I would like to create a platform Expression Rule that execcutes upon file upload, and attaches the uploaded file to an email and sends it to a designated address. What is the most efficient way to implement this on the platform?
I currently have connected assets uploading event log files (.zip archives).
Thanks!
Solved! Go to Solution.
Brenton,
Here are four examples of sending an email using the Axeda Platform: email | Axeda Developer Connection
To set up the Expression Rule for a file upload follow the instructions in File Namespace
I hope this helps. Good luck.
Rob
Brenton,
Here are four examples of sending an email using the Axeda Platform: email | Axeda Developer Connection
To set up the Expression Rule for a file upload follow the instructions in File Namespace
I hope this helps. Good luck.
Rob
I was able to use the 'File' trigger type, along with If has("log", File.names) to then call a custom action and send a notification upon file upload. It appears to now be working as intended.
Thanks,
Brenton
How did you ensure the the Custom Object always sent the right file? Could you pass the fileId from the Expression Rule?
Alan
Hi Alan
If the Expression Rule's type is set to 'File' then you can access the file that triggered the ER in the Custom Object executed by the ER:
UploadedFile[] files = compressedFile.getFiles()
File file = files[0]?.extractFile()
assert file != null
logger.debug ("getAbsolutePath : ${file.getAbsolutePath()}")
logger.debug ("getCanonicalPath : ${file.getCanonicalPath()}")
logger.debug ("getPath : ${file.getPath()}")
Hope this helps
Maciej
Thanks Maciej,
And if the files came up in a set i could iterate through the files array you created to process each one?
Regards,
Alan
Hi Alan,
I would expect that if you have an archive file that contains multiple files then you would iterate the collection/array and extract individual files if you need to do so.
Thanks
Maciej