Pages

Helpful Links

Thursday, November 10, 2011

Oracle BPM: Send Email to End Users

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.

Workflow
Now add an automatic activity below:

Automatic Activity
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

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

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:
  1. Go to project Navigator
  2. Right Click your project
  3.  Select Engine Preferences
  4. Select Engine -> General Tab
  5. In networking panel, give smtp server, port and admin Email.  
  6. Save your project 

In Enterprise Standalone:

  1. Go to Process Administrator
  2. Select Engines
  3. Click on your Engine
  4. Go to networking tab and enter your settings
  5. It requires smtp server, port, Admin Email, URL (The URL for End Users)
  6. Click Save and Apply

No comments:

Post a Comment