You are on page 1of 7

1.

Adhoc Roles in Oracle Workflow:

Adhoc roles can be created through PL/SQL from database or they can be created from Applications using User Management Responsibility. If you use PL/SQL to create roles make sure you give all user names and role names in UPPER case to avoid some problems. Script to Create a Adhoc Role

DECLARE lv_role varchar2(100) := 'HP_WF_TEST_ROLE'; lv_role_desc varchar2(100) := ' HP Workflow Test Role'; BEGIN wf_directory.CreateAdHocRole(lv_role, lv_role_desc, NULL, NULL, 'HP Test Role for WF Demo', 'MAILHTML', 'PSHRIGANESH SHOBHANA', --USER NAME SHOULD BE IN CAPS NULL, NULL, 'ACTIVE', NULL); dbms_output.put_line('Created Role' ||' '||lv_role); End; / COMMIT;

Once you run the above script in POC12 instance, now query for the roles related workflow tables. o WF_LOCAL_ROLES The above script populates the Roles into this table.

WF_ROLES Its a view based on WF_LOCAL_ROLES table that stores the Role Name and other details.

WF_USER_ROLES holds the Users associated to that Role.

Script to Add user to already existing Adhoc Role

DECLARE v_role_name varchar2(100); v_user_name varchar2(100); BEGIN v_role_name := 'HP_WF_TEST_ROLE'; v_user_name := 'CKRISHNA'; WF_DIRECTORY.AddUsersToAdHocRole(v_role_name, v_user_name); --USER NAMES SHOULD BE in CAPS END; / COMMIT; Once you run the above script, it will add user CKRISHNA to the existing Role 'HP_WF_TEST_ROLE'.

Script to Remove user from existing Adhoc Role

DECLARE v_role_name varchar2(100); v_user_name varchar2(100); BEGIN v_role_name := 'HP_WF_TEST_ROLE'; v_user_name := 'CKRISHNA';

WF_DIRECTORY.RemoveUsersFromAdHocRole(v_role_name, v_user_name); --USER NAMES SHOULD BE in CAPS END; / COMMIT; The above script will remove the user from the existing Role 'HP_WF_TEST_ROLE'.

Tables:
WF_ROLES WF_USER_ROLES WF_LOCAL_ROLES WF_USER_ROLE_ASSIGNMENTS

Using Adhoc roles in workflow notifications:

Connect to Workflow Application to see the Adhoc Role Functionality: Select Send Greetings Notification Ok

Navigation: File Load Roles from Database Select roles you want to use and then click OK.

Enter Find Roles: HP Workflow Test Role Find

Select HP Workflow Test Role and Add Ok

Now Go to Birthday Greeting Process and Open the notification properties and then navigate to node
tab, select performer as the role we just created and loaded from database.

Apply Ok and Save

Run PL/SQL anonymous block to launch our workflow. It will send the notification to every user attached to the Role HP Workflow Test Role.

This way we can use the roles to send few notifications to only few people based on their designation.

Key Workflow Tables/Views: Numerous Oracle tables and views are accessed during a workflow process and a full listing may be found in the Workflow Technical Reference Guide. Key Oracle Workflow tables and views have been listed below along with a description of the data stored within each object. WF_ACTIVITIES Activities (processes, notifications, functions) which are included in a workflow process WF_ITEMS Workflow processes WF_ITEM_ACTIVITY_STATUSES Workflow process activity results and error information WF_ITEM_ATTRIBUTES Item attribute definitions WF_LOOKUPS Workflow lookups WF_LOOKUP_TYPES Workflow lookup types WF_MESSAGES Messages which are sent as notifications WF_MESSAGE_ATTRIBUTES Message attributes (additional information to be sent to or received from an Individual via notifications) WF_NOTIFICATIONS Sent messages WF_NOTIFICATION_ATTRIBUTES Sent message attributes WF_ROLES Roles of users from HR tables WF_USERS Users from HR tables WF_USER_ROLES Users and their corresponding roles from HR tables

You might also like