Pages

Helpful Links

Wednesday, November 23, 2011

Oracle BPM: Working with project variables

There are four types of variables used in Oracle BPM.
  1. Project Variable
  2. Instance Variable
  3. Local Varaible
  4. Predefined
Project variables are really important, they are designed at the time of project design as they have links in Engine and BAM database as well as the Datamart and Archive database. They are really important as they are used at time of reporting. Project variables have many advantages:
  • Project variables are defined at project level to integrate with all processes
  • Project variable are present inside the engine database
  • They are visible to end users on their workspace
  • Workspace and Database searches and sorting can be performed through project variables
  • Same project variables can be reused in different projects
  • They can be used as business indicators that can be used in BAM and Datamart
  • Project variable are accessible from all activities and processes
Project variable have a limit of 256 variables per project.

Below is the way we can add project variables to a project. I am using the same project used in previous posts:
Original Process

Now we go to the projects tab on the right side of the screen, if it is not visible go to window -> Show view -> Click on variables
Now Click + icon and a new window appears:

Project Variables
The basic information should be entered then select the business indicator.

Now for all the project variables add them as per your project
Added PVs
Once the PVs have been added then click on the icons on top titled "Map as Incoming Argument" and "Map as Outgoing Argument". These will make the incoming and outgoing arguments for all the Variables. Now Double Click on Begin activity you can see all the defined variables and assign them the variables as per project requirements as shown:

Begin Activity
These PVs can be defined in any Activity outgoing process as well. After argument mapping you can add or update all PVs through all the activities. In the workspace it looks like this:

Workspace Showing 3 Added PVs at end
Keep reading and you are free to request any view or comment.

Thursday, November 17, 2011

Oracle BPM: Working with Deadlines, Calendar and Holiday Rules

Working with deadlines is the core of every tracking and time related process. Deadlines are really important for a project to be completed on time and additional resources are required if a project is lacking time. Good planning always involve using deadlines. In BPM also, Deadlines are given a lot of importance, if the deadlines are not met reminders can be generated for approval, moving forward, skipping activities and generating emails to the required participants a.k.a users.

There is a small problem that most of the industry and offices work in shifts and usually have one or two days off in a week, its an irony :), so calendar rules needed to be generated so that deadlines exist and expire in working time or when most of the staff are present on their desk. In addition to calendar rules we have also got both expected and unexpected holidays for example weekends, country national days, regional holidays like Religious festivals. The need is to include these holidays into our plan so that these holidays are not hurting the deadlines.

In the discussion below I will show how to use deadlines in a simple way with the integration of holiday and calendar rules. We start by using the simplest flow of inventory approval used in earlier post.

Simple WorkFlow

Now we want to add a deadline for the approval activity so that a reminder is generated after the deadline is passed. For example an email can be sent or if no activity is done in the deadline period it is reassigned to another participant.

Deadline Added on Approval activity

Check the swim line of Head of Department role, you can see a new automatic activity has been added with a due transition. In the due connector add the time of deadline.

Inside Due transition
This is the simplest way to add deadline. The variable entry is of interval type. Now see the workspace below showing 1 day deadline. Suppose we started the instance reached Approval Activity on Nov 17, 2011 and deadline is calculated after a day that is Nov 18, 2011.

 
Workspace showing deadline

Now we are going to add calendar and holiday rules and integrate them with deadlines.

Add Holiday Rule:
  1. Go to Organization, inside your project
  2. Right click Holiday Rules 
  3. New 
  4. Name it
  5. Then a new tab opens 
  6. Click Add 
  7. Add the Holiday you want for example suppose tomorrow Nov 18, 2011 is a holiday.
Add Calendar Rule:
  1. Go to Organization, inside your project
  2. Right click Calendar Rules
  3. New 
  4. Name it
  5. Then a new tab opens
  6. Add your companies shift timings or necessary information, I have given Saturday and Sunday as Holiday. See Figure Below
  7. Add Holiday Rule made earlier into the Calendar Rule and Save it.

Add Calendar Rules

Now go to project Navigator -> Select Your project -> Your Module -> Right Click Module -> New -> BPM Object -> In the Object Make a method called set Calendar Deadlines and a variable integer for number of days.As shown in the figure below:

Calendar Rule Code
This is code inside the method for calendar deadlines. Make sure the server side method is Yes and return type is Interval, As seen in the figure above save it

//Code for Calendar Rule

calendar as CalendarRule

calendar = CalendarRule.fetch(calendarName : "CRule")
start as Time
memday as Time
start = 'now'
memday = start
newdead as Time

count as Int
count = 0
numDays=1
numDays=numDays+1

if numDays> 0 then
    while count < numDays do
        if (isHoliday(calendar, time : start) == false &&
        isWorkDate(calendar, time : start) == true) then
            count = count + 1
        end
    start = start + '1d'
    end
start = start - '1d'
end
newdead=start


deadint as Interval
deadint=newdead-'now'
return deadint


Save Project. Go back to Due Activity -> Properties and write the code below Inside Due Transition.


PDProcess.CalRulOBject.setCalDeadlines(numDays:1)

<module>.<CalendarRuleObject>.<method>(variable:value)

Now if we calculate the new deadline like Nov 18, 2011 is holiday and Nov 19 and Nov 20 are weekly offs. The new deadline will be calculated to Nov 21, 2011. As show below.

Deadline Solution
 Looking forward to any queries, suggestions and questions. Leave a comment here or E-mail me with reference to this topic.

Best Regards



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

Friday, November 4, 2011

Oracle BPM: How to add external Resources (Databses) in Presentations

Hello Everyone!!!!!!!!

One of the most important task of using BPM is getting data from different sources, databases and different type of webservices into your project. This is like a tutorial to importing databases into your bpm project. For this example I will be using the simple WorkFlow below:

Work Flow
In this workflow the initiator select the item to issue and Head of Department Approves it and issuer checks it. As the inventory is another system we only need to get the list of available products for approval and issuance through BPM.


First go to project Navigator and select your project. Then right click on external resources and select "new external resource". A new window opens up. Give the name of your external resource and Type as "SQL Database". Select the type of external resource you are using not necessarily SQL; it can be a SAP service, a webservice or Java service depending on your needs, just browse through the list find the appropriate. If you have select the SQL database then a new field opens up called "Supported Types". In this LOV we select the DB we are using or its driver.

Add External Resource
Add Host name or ip address of DB server. Port by default is 1521 or your customized, user or schema name, its pass and schema name. You can also check the Advanced settings. Then go to tablespaces tabs and give the name of tablespace; As shown below:


Now import the external database to your module by Catalog --> Your module, then right click your module select catalog component and select SQL or the external resource you added. Then a new window appears that shows all the SQL resources you added select it then press next. Now it will show you all the Tables present in your schema select the tables you want to import and press next.It now appears as the picture on the Left.
When this external resource is added it will appear under external resource. Now go to  Catalog --> Your module --> Your BPM Object --> Double click the attribute you want to get an LOV. Go to valid Values and select Dynamic method. Click new under "method or values....."
Dynamic LOV Attribute

Name your new method and then write the query like the one below:    Do remember to select Server Side Method to "Yes".

Query to get LOV

After the successful query Your results in the form will look like this:

Presentation

If you have any query or question leave a comment and i will get back asap.