g) How To Send Notification To Multiple Users
Oracle Workflow roles are stored in the database, in the Oracle Workflow directory service.The performer can be an item type attribute that dynamically returns a role.To send a single notification(FYI/Actionable) to multiple users we have to use Role attribute as performer of that notification.The attribute value must be the internal name of a role.
Here we will discuss how can we send a single notification to multiple users.
Basic Requirement
Our old requirement looks like "when a person applies for a leave it should go his/her supervisor for approval.Approver must be able to provide his/her approval/rejection comments. The comments must be entered by the approver while rejecting the leave requisition.If he/she rejects the leave requisition without entering comments, then it should raise an application error.If he/she approves the requisition it should be optional.Approver must also be able to select theOrganization Leave Type from a list of values . If the leave gets rejected, don’t store any information in database.The approver should able to view/edit the person "Special Information Types" before approving the leave request.Before approving the sick leave request the approver must able to see the submitted medical document."
Now we will twist our original requirement- Instead of going to Supervisor for approval, all the leave request must go to the following identified people
Solution Approach
First we will discuss about the changes that we need to do in workflow Definition.
A) Workflow Part
1) Load the latest workflow definition from database.
2) Create an item attribute of Type Role
Internal Name:- XX_TEST_ROLE
Display Name:- Test Role for Approval
Type :- Role
4) Validate your design and save it to database.
B) Role Definition create Part
Role can be defined and used in worklfow in two different ways.
a) Create a Global Application Role
b) Create database Adhoc Role
We will first discuss how can we define Role from Oracle Application and use the same in workflow.
a) Create a Global Application Role and its usages in workflow
i) Go to UK HRMS Manage >> Transaction Maintanance >> Global Roles
ii) Create your custom Global Role and add the desired users (Users must have a valid active fnd_user entry). Save your definition.
iii) Our Application Role definition creation is complete now we have to set the value for our newly created Role attribute. The value of the Role attribute should be the
name of the role. Workflow engine will take the names from the role and will send the notification automatically.
We will set the value for Role attribute in our Trigger workflow procedure (Where we are setting the other attribute values)
To set the Role attribute we need to call wf_engine.SetItemAttrText procedure. This will internally check for Role attribute(though this utility is for setting Text attribute) and perform the task accordingly.
iv) Now compile the package and workflow is ready to trigger.
b) Create database Adhoc Role and usages
Instead of creating a Global Role from application we can also create an database adhoc role and use the same to send notification.
i) Create a adhoc Role using wf_directory.CreateAdHocRole ultility. This will create a role in database,.
wf_directory.CreateAdHocRole(role_name in out varchar2,
role_display_name in out varchar2
language in varchar2 default null,
Enter the value for "role_name" (Must not be more than 320 character and keep the name in uppercase) and "role_display_name" parameter. Keep the other parameter to its default value.
If you want to make this role inactive after definite time period enter value for it (Ex:- for 365 days it should be sysdate+365. Means after 365 days role will be expired).
Here
role_name =>XX_TEST_ADHOC_ROLE
role_display_name=>Test Adhoc Role
ii) Add the user to the newly created Role using wf_directory.AddUsersToAdHocRole utility.
wf_directory.AddUsersToAdHocRole(role_name in varchar2,
c in varchar2
)
Here
role_name => Internal name of the role
role_name => User name of the list of users that we need to add. The user name of the users must be either comma/space separated.
iii) Now set the Role attribute value. The value of the Role attribute should be the Internal name of the adhoc role.
To set the Role attribute we need to call wf_engine.SetItemAttrText procedure. This will internally check for Role attribute(though this utility is for setting Text attribute) and perform the task accordingly.
iv) Now compile procedure and workflow is ready to trigger.
Note:- 1) As we see we can define Role in two ways 1) Global Application Role 2) Database Adhoc Role.
When we have a identified static list of approver/stakeholder to whom we need to send the notification we will use the Global Application
Role. It is easy to maintain.
When we have a dynamic list of approver/stakeholder (if our requirement is something like send the notification to all the people who are in a
particular grade) to whom we need to send the notification we will use the database adhoc Role.
2) If we check the "Expand Roles"(Double click on notification >> Notification Tab) check box it will send an individual copy of the notification message to each user in the role(The notification id will be different). The notification remains in a user’s notification queue until the user responds or closes the notification.
Since this is a actionable notification and we are not using voting activity thus "First responder Win" happen.
If any of the role performer acts on the notification it will "Closed" in his/her queue. Whereas other will see it as "Cancelled".
3) Oracle Workflow does not support including the action history in a notification with the Expand Roles check box selected, which causes a separate copy of the notification to be sent to each user in the recipient role.
|
No comments:
Post a Comment