End user communication is really important for any project. In oracle bpm there is no direct way to send emails to End Users. It can be easily done from any automatic activity. We are gonna use the scenario below. The Email will be sent from initiator to the head of Department with the details of the issuance criteria.
Now add an automatic activity below:
An Email will be sent whenever an instance passes this automatic activity. This activity is given Add the code below in the automatic activity as it requires some customization with regards to your own project. Notice that HTML syntax are being used. You can use all HTML syntax's to improve the style of your emails.
//Email Code Starts here
In Enterprise Standalone:
Workflow |
Automatic Activity |
//Email Code Starts here
mydate as Time
dateString as String
mydate = 'now'
dateString = format(mydate, mask : "dd-MMM-yyyy")
reminderEmail as Mail
reminderEmail = Mail()
cc as String[]
bcc as String[]
bb as String[]
reminderEmail.from = "bpmadmin@example.com"
reminderEmail.recipient = "<target recipient>" + "<target recipient>"
bcc[] = "Administrator@example.com"
reminderEmail.subject = "Activity submitted at your end" + instance_variable.number
reminderEmail.contentType = "text/html;charset=UTF-8"
reminderEmail.message = "Dear User," +
"\nA new work has been submitted for your approval\n" +
"\n Product: " + instance_variable.product +
"\n qty: " + instance_variable.qty +
"\n type "+ instance_variable.type +
"\n Approval Deadline is: " + dateValue(Approval_Deadline) +
"Regards \n Administrator"
reminderEmail.cc = cc
reminderEmail.bcc = bcc
sender as MailSender
sender = MailSender(mail : reminderEmail)
send sender
dateString as String
mydate = 'now'
dateString = format(mydate, mask : "dd-MMM-yyyy")
reminderEmail as Mail
reminderEmail = Mail()
cc as String[]
bcc as String[]
bb as String[]
reminderEmail.from = "bpmadmin@example.com"
reminderEmail.recipient = "<target recipient>" + "<target recipient>"
bcc[] = "Administrator@example.com"
reminderEmail.subject = "Activity submitted at your end" + instance_variable.number
reminderEmail.contentType = "text/html;charset=UTF-8"
reminderEmail.message = "Dear User," +
"\nA new work has been submitted for your approval\n" +
"\n Product: " + instance_variable.product +
"\n qty: " + instance_variable.qty +
"\n type "+ instance_variable.type +
"\n Approval Deadline is: " + dateValue(Approval_Deadline) +
"Regards \n Administrator"
reminderEmail.cc = cc
reminderEmail.bcc = bcc
sender as MailSender
sender = MailSender(mail : reminderEmail)
send sender
After using this code you should be able to send E-mails to many participants.
One more thing, You have to add smtp settings.
In studio:
- Go to project Navigator
- Right Click your project
- Select Engine Preferences
- Select Engine -> General Tab
- In networking panel, give smtp server, port and admin Email.
- Save your project
In Enterprise Standalone:
- Go to Process Administrator
- Select Engines
- Click on your Engine
- Go to networking tab and enter your settings
- It requires smtp server, port, Admin Email, URL (The URL for End Users)
- Click Save and Apply
No comments:
Post a Comment