Thursday, February 16, 2012

Workflow Notifications to Users/Roles

Workflow Notifications are sent to the Users/Roles for which setup has been done through Oracle Apps.
Its possible to create Users/Roles using workflow API and all this information is stored in below Oracle
Database tables

FND_USERS:
stores the Oracle application user data that is setup through System administrator>User. It links
employee id to the User id, along with email id


WF_USERS/WF_LOCAL_USERS:
stores User data along with email id to which Notification is to be sent. When A new user is
defined in oracle apps along with fnd_user table a new record is inserted into this table.

WF_ROLES/WF_LOCAL_ROLES:
store roles information

WF_USER_ROLES:
Associations of users with the roles

To sent a notification to a particular User following steps need to be performed
1. Add a Notification node to the workflow process
2. Create a attribute of type ROLE in workflow and at the node just before sending the notification
   setup the value of attribute using below api
            wf_engine.SetItemAttrText
                (itemtype        => x_item_type
                ,itemkey        => x_item_key
                ,aname            => 'MAIN_USER'
            ,avalue            => x_user);
   Here x_user is user_name/name fetched from fnd_users/wf_users table for that person

3. Open the Notification node in the process and on 'Node' tab select the Performer as the
   Type "Item Attribute" and value as attribute.
  
Whenever the workflow process is initiated and notification is sent, the table WF_NOTIFICATIONS
is populated with RECIPIENT_ROLE as X_USER


Notification to multiple Users:
In workflow if you need to send a Notification at once to different Users, you need
to create a role using below API.
-- Create adhoc role
wf_directory.createadhocrole
    (role_name             => x_role_name
    ,role_display_name        => x_role_name
    ,LANGUAGE                       => NULL
    ,territory                      => NULL
    ,role_description               => 'MAIN_ROLE'
    ,notification_preference    => 'MAILHTML'
    ,role_users                    => NULL
    ,email_address                    => NULL
    ,fax                        => NULL
    ,status                => 'ACTIVE'
    ,expiration_date        => SYSDATE+ 60
    ,parent_orig_system         => 'WF_LOCAL_ROLES'
    ,parent_orig_system_id        => 0
    ,owner_tag            => NULL);


Once role is created now add Users to Role using below API. In below API the parameter
role_users is passed with list of USER_NAME separated by space.
--Add Users to Role
wf_directory.AddUsersToAdHocRole
    (role_name     =>x_role_name,
     role_users     =>'Username1 Username2 Username3');

To verify the details please check with below queries

--Check the Role name
select * from wf_roles where name like x_role_name;

--Check the User associated with the Role
select * from wf_user_roles where role_name like x_role_name;


6 comments:

Praveen said...

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 If anyone interested to take Oracle Apps Functional Online Training, please reach us KBS Training Institute located at Bangalore. Rated as best training institute in Bangalore.

oracle fusion procurement online training said...

Hi, thanks for sharing this informative post. if all people interested in taking oracle fusion procurement education please reach us this academy placed in Hyderabad. rated as first-rate education institute in Hyderabad
thank for sharing information
oracle fusion procurement online training
oracle fusion procurement training

oracle fusion SCM said...

Hi,
this is a very interesting topic.
really its useful site above given information very helpful to me.
oracle fusion SCM online training

oracle hcm online said...

Hi,
this is very interesting topic. Thanks for sharing such a nice topic.\
oracle fusion HCM training.

Unknown said...

How to add users dynamically from a lookup to the adhoc role.

Galdguru Marketing said...

Thank for sharing your valuable information or connect with ggmpl with best opporitunity