7
1. Adhoc Roles in Oracle Workflow: Adhoc roles can be created through PL/SQL from database or they can be crea from ApplicationsusingUser Management Responsibility. If you use PL/SQL to create roles make sure you give all user names and ro names in PP!R case to avoid some problems. Script to Create a Adhoc Role "!#LAR! lv$role varchar%&'(() *+ ,-P$ $0!S0$R1L!,2 lv$role$desc varchar%&'(() *+ , -P ork3o4 0est Role,2 5!6I7 4f$directory.#reateAd-ocRole&lv$role8 lv$role$desc8 7LL8 7LL8 ,-P 0est Role for "emo,8 ,9AIL-09L,8 ,PS-RI6A7!S- S-15-A7A,8 ::S!R 7A9! S-1L" 5! I7 #APS 7LL8 7LL8 ,A#0I;!,8 7LL)2 dbms$output.put$line&,#reated Role, <<, ,<<lv$role)2 !nd2 / #199I02 1nce you run the above script in P1#'% instance8 no4 =uery for the roles re 4ork3o4 tables. o WF_LOCAL_ROLES 0he above script populates the Roles this table. o WF_ROLES – It>s a vie4 based on $L1#AL$R1L!S table that stores the Role 7ame and other details.

Adhoc Roles Workflow

Embed Size (px)

DESCRIPTION

Adhoc Roles Workflow

Citation preview

1. Adhoc Roles in Oracle Workflow:

Adhoc roles can be created through PL/SQLfrom database or they can be created from Applications usingUser Management Responsibility. If you usePL/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

DECLARElv_role varchar2(100) := 'HP_WF_TEST_ROLE';lv_role_desc varchar2(100) := ' HP Workflow Test Role';BEGINwf_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.

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 toAdduser to already existing Adhoc RoleDECLAREv_role_name varchar2(100);v_user_name varchar2(100);BEGINv_role_name := 'HP_WF_TEST_ROLE';v_user_name := 'CKRISHNA';WF_DIRECTORY.AddUsersToAdHocRole(v_role_name, v_user_name);--USER NAMES SHOULD BE in CAPSEND;/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

DECLAREv_role_name varchar2(100);v_user_name varchar2(100);BEGINv_role_name := 'HP_WF_TEST_ROLE';v_user_name := 'CKRISHNA';WF_DIRECTORY.RemoveUsersFromAdHocRole(v_role_name, v_user_name);--USER NAMES SHOULD BE in CAPSEND;/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: FileLoad Roles from DatabaseSelect roles you want to use and then click OK.

EnterFind 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, selectperformeras 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 processWF_ITEMS Workflow processesWF_ITEM_ACTIVITY_STATUSES Workflow process activity results and error informationWF_ITEM_ATTRIBUTES Item attribute definitionsWF_LOOKUPS Workflow lookupsWF_LOOKUP_TYPES Workflow lookup typesWF_MESSAGES Messages which are sent as notificationsWF_MESSAGE_ATTRIBUTES Message attributes (additional information to be sent to or received from anIndividual via notifications)WF_NOTIFICATIONS Sent messagesWF_NOTIFICATION_ATTRIBUTES Sent message attributesWF_ROLES Roles of users from HR tablesWF_USERS Users from HR tablesWF_USER_ROLES Users and their corresponding roles from HR tables