SEND EMAIL FEATURE
both server-side and client-side EPM Automate supports the sendmail command to send custom email notifications to users. This is commonly used to summarize the tasks from scheduled jobs and inform system administrators of the job status
PIPELINE IS AN AWESOME ADDITION
With the new pipeline feature, which sends a well-formatted email with each task and the necessary information, we can now sit back and let the pipeline handle all of the tasks for us. The Oracle development team has done a great job, and this is a significant time saver.
SIZE LIMIT IN EMAILS
Although server-side EPM Automate is here to stay, it has the limitation of only allowing email attachments of less than 10MB. This can be a problem for admins who need to send large text files as attachments, such as those exported from Essbase. In this blog post, we will see how to use Groovy to compress text files so that they can be sent as email attachments in EPM Automate.
When compressing a text file, we can typically save up to 90% of the file’s original size. This means that a 100MB text file can be compressed to about 10MB. This is because the compression algorithm removes redundant data from the file. As a result, we can send text files that are larger than 10MB by compressing them first.
CREATE ZIP FILE WRITER
To generate the zip file, we will use the createZipFileWriter
function from the EPMScript
class. The records of the exported file can be read from a CSVIterator
object.
//define Zip file parameters
String zipFileName = 'Budget_Data_Export_FY23.zip'
String innerFileNameOfZipFile = 'Budget_Data_Export_FY23.csv'
//define the source file that needs to be compressed
String exportedFileName = 'Budget_Data_Export_FY23.csv'
//generate the new zip file
createZipFileWriter(zipFileName, innerFileNameOfZipFile).withCloseable { zipFile ->
csvIterator(exportedFileName).withCloseable() { iterator ->
iterator.each { row ->
zipFile.append("${row.join(',')}\n")
}
}
}
SEND EMAIL USING SERVER-SIDE EPM AUTOMATE
//define server-side epm automate parameters
String user = '[email protected]'
String password = 'password.epw'
String url = 'http://localhost:9000'
String emailToAddresses = '[email protected]'
List<List<String>> sendEmailTasks = [
['login', user, password, url],
['sendmail', emailToAddresses ,'ZIP Email' , "Body=Test Zip Email", "Attachments=$zipFileName"],
['logout']
]
EpmAutomate automate = getEpmAutomate()
sendEmailTasks.each {List<String> task ->
EpmAutomateStatus status = automate.execute(task as String[])
if(status.status != 0) {
throwVetoException("Error: $status.output")
} else {
println("INFO: $status.output")
}
}
RULE EXECUTION
I have a ~42MB file that has been compressed to 4MB successfully.
Let’s try sending a 42MB email attachment.
Let’s try sending the compressed file
CONCLUSION
Although we are currently only allowed to put one inner file in a zip file, compressing files can still be useful for reducing file size and speeding up file transfers. I am looking forward to testing the unzipping feature that comes with pipelines in this month’s update. I hope this blog post has been helpful.