cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to send Event Log files via Email

brenton.parks
1-Newbie

How to send Event Log files via Email

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6

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

mredel
1-Newbie
(To:ablyth)

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

ablyth
7-Bedrock
(To:mredel)

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

mredel
1-Newbie
(To:ablyth)

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

Top Tags