Tuesday, October 9, 2012

Sending Multiple Notification Using ADHOCROLE


1.Create a Attribute(XX_APPROVER) of type 'Role'.
2.Create a Notification and set the Performer as XX_APPROVER.
3.Create a ADHOC user Group
V_USER_CONCAT :='user1 user2 user3';
XX_FYI_ROLE : ='XX_FYI_ROLE';
      WF_DIRECTORY.CREATEADHOCROLE
          (
         ROLE_NAME                             => XX_FYI_ROLE
          ,role_display_name                     => XX_FYI_ROLE
          ,LANGUAGE                              => NULL
          ,territory                                      => NULL
          ,role_description                         => 'MAIN_ROLE'
          ,notification_preference             => 'MAILHTML'
          ,role_users                                  => NULL
          ,email_address                            => NULL
          ,fax                                               => NULL
          ,STATUS                                     => 'ACTIVE'
          ,PARENT_ORIG_SYSTEM      => 'WF_LOCAL_ROLES'
          ,OWNER_TAG                           => NULL
);


4.Add User to the role
      WF_DIRECTORY.ADDUSERSTOADHOCROLE(
                                       ROLE_NAME      =>XX_FYI_ROLE,
                                       ROLE_USERS     =>V_USER_CONCAT
                                       );


5.Attach the Role to the attribute(XX_APPROVER)

         WF_ENGINE.SETITEMATTRTEXT (
                                    ITEMTYPE     => ITEMTYPE,
                                    itemkey            => itemkey,
                                    ANAME         => 'XX_APPROVER',
                                    AVALUE        =>  XX_FYI_ROLE 
                                   ); 
To Delete a User From User Group :

          WF_DIRECTORY.RemoveUsersFromAdHocRole(XX_FYI_ROLE,
  V_USER_CONCAT
  );
Query to Get all the USers attached to a Role :
select user_name from wf_local_user_roles where role_name like 'XX_FYI_ROLE';

No comments:

Post a Comment