Article: AN0001838Updated: 03.10.2018
In order to meet the requirements it is necessary that the workflow takes over basic information about the request that will drive the workflow course. This can be ensured by passing this information into workflow properties at the time when workflow is started by means of a script executed after saving a record in the class Request. Another possibility is to find out this information in the workflow in the activity script (e.g. looking up manager, application gestor etc.). Workflow started within rule applied after a new record save is started in context of this record and therefore, we can refer to it by means of object OGWFActualRun (property InputDataRow).
Within workflow we will find out if there are manager and gestor and in such a case we will assign a task to them in which they will be able to approve or reject the request (workflow activity Task). On the tab Initialization script we perform assignment of users to the task, update request status to "Pending for approval" and add new record to the class Request flow informing about assignment of the request for approval to the corresponding user. On the tab Script after user entry we will find out if the user approved or rejected the request and according to that we will update corresponding workflow property that will later on determine next course in the workflow scheme. We will also add here a record into the class Request flow informing about the action of the manager/gestor and their comment (reason for approval or rejection).
Activity Task ensures informing users about assigning the task via email (see the property Send a default email after creation on tab Basic properties). We do not need to take care of delegation of users in the workflow scheme. We can use delegation, where the user can set its deputy in case of the absence. If it is necessary the task can be assigned to more users and by means of option Action on tab Basic properties we can determine, whether the task is approved/rejected at the action of the first approver (option After record save: First processing cancels other tasks) or whether all the users have to approve it (option After record save: Process all the tasks).
In case manager or gestor do not exist, we will go directly to access rights assignment.
In case of rejection of the request we will change the request status to "Refused" and terminate the workflow.