Friday, 24 April 2015

Creating WF Local Roles: Script to Create an Adhoc Roles

Adhoc roles can be created through PL/SQL from database or they can be created from
Applications using User Management Responsibility. If PL/SQL is used to create roles,
all user names and role names in UPPER case to avoid some errors:


Script to Create an Adhoc Role:
-------------------------------
DECLARE
   vRole     VARCHAR2(100) := 'XAOATESTROLE';
   vRoleDesc VARCHAR2(100) := 'XAOATESTROLE';
BEGIN
   wf_directory.createAdhocRole(    vRole,
                                    vRoleDesc,
                                    NULL,
                                    NULL,
                                    'Test Role for All Oracle Apps users',
                                    'MAILHTML',
                                    'OPERATIONS', --USER NAME SHOULD BE IN CAPS
                                    NULL,
                                    NULL,
                                    'ACTIVE',
                                    NULL
                                 );

   dbms_output.Put_line( 'Created Role'
                         ||' '
                         ||vRole);
   COMMIT;                      
END;
/

Result:

Created Role XAOATESTROLE