AssignOwner is a dynamic way to set the owner of the request. This is useful and important since it’s the only service that maintains EP_Workflow_Request_Owners table, which is for user access control to any workflow request.
You can use the AssignOwner service in any type of processes. However, it’s highly recommended that you use it in a workflow StatusArrival process, since it’s the first thing the system runs after a workflow status change, such as approving or rejecting a request, which leads to an owner change.
There are 3 types of owner type you can choose - *User, *Role and *UserProperty.
- *User: This will set the owner to a specific user.
- *Role: This will set the owner to a specific role. It must be one of the roles you added in the workflow settings. All the users you added for that role are the owner of the request.
- *UserProperty: This will set the owner to all users that meets your criteria - Column Name = Value. Column Name must be in EPUsers table and stored in OwnerId field. Value will be stored in OwnerPropertyValue field.
Once the workflow is completed, the owner record will be deleted automatically from EP_Workflow_Request_Owners table.
If you have any question about EASYProcess workflow, please refer to the Workflow document for further explanation.
AssignOwner Use Examples
AssignOwner using *User
In this example the owner of the request is assigned to a specific user. AssignOwner is called in StatusArrival. Please note that the UserId you use in the OwnerId field must exists in EPUsers table. Fail to do so will cause the other services like GetRequestsInQueue not working as expected.
In EP_Workflow_Request_Owners table, you will see the owner of the request is updated to the UserId in OwnerId field.
AssignOwner using *Role
This is an example if you assign the owner to a group of users. AssignOwner is called in StatusArrival. Please note that the role name in OwnerId field must be added first in workflow. Please refer to workflow document for adding roles and role users.
In the log, you can see the service returns 1 field shows it runs successfully or not.
In EP_Workflow_Request_Owners table, you will see the owner is updated to Admin role. All the users you added to this role will be the owner.
AssignOwner using *UserProperty
This is an example that we set the owner to all users with UserAuthorizationType = Manager.
In the request owner table, you will see the value in the corresponding fields. When you call GetRequestsInQueue service, if the user has UserAuthorizationType = Manager, the request Id will be returned.
This works because each record in the EP_Users table has a property called UserAuthorizationType. It will use the “UserAuthorizationType” and “Manager” values given to filter the EP_Users table to assign ownership to the subset of the EP_Users table selected with that given filter.