Saturday, January 28, 2017

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;

No comments:

Post a Comment

Types of animations

Animation is a diverse and creative field with a variety of styles that artists and filmmakers use to bring their visions to life. Here are ...