Saturday, November 14, 2009

Workfllow adhoc Role Expiry

I created one adhoc role using wf_directory.createadhocrole and set its expiry to 15 days. Then on 16th day, I tried to create the same role, but the routine failed, cause was "Duplicate Role Name".

I checked WF_ROLES, and I did not find the expired role there. Then I checked WF_LOCAL_ROLES, the role end date was in past, but the role status was still active.

To avoid error, I added following before creating new adhoc role.
 wf_directory.setadhocrolestatus('ADROLE' , 'INACTIVE');
 wf_directory.deleterole('ADROLE' , 'WF_LOCAL_ROLES' , 0);
.

This makes sure the old role is deleted before creating a new one with same name.

No comments: