Example Advanced function: Me
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords">
example, class me, classes me, me, class, duration, estimatedsolutiondate
</keywords>
Contents |
Examples of Advanced Function Me
Me.Duration Example
Manual and User tasks, Intermediate events and Timer events must have a duration and it must be specified. There are two ways to set this value: in the shape's properties or with an Expression. An Expression is used when the duration is not constant and may vary in time.
In a Credit Request process, when a client is interested in a loan, the bank asks for some documents in order to analyze the client´s risk. A Timer Event is used to wait for the client to hand in the documents. However, it depends on the type of loan the client is asking for.
If it is a mortgage loan it usually takes 3 weeks for a client to gather up all the requested documents. If it is a Personal loan, it takes one week.
1. Create a vocabulary for both durations (in minutes). This allows the administrator to change its value when necessary from the web application.
Mortgage duration = 3 weeks * 5 days of a week * 8 hours a day * 60 min an hour = 7200 min
Personal loan duration = 1 week * 5 days of a week * 8 hours a day * 60 min an hour = 2400 min
2. Create the rule to set the Duration according to the type of loan.
For this example we declare two variables: Mortgage duration and Personal loan duration.
Then an if is used to evaluate the type of loan requested:
- If the loan is Mortgage, then from the vocabulary created, resolve "MortgageDuration"
Set the time the vocabulary resolves using Me.Duration.
- If the loan is not Mortgage (we use the else of the if shape), then from the vocabulary created resolve "PersonalLoanDuration"
Set the time the vocabulary resolves using Me.Duration.
3. Finally using the Project Wizard go to the Step 4 and select Activity Actions. A new window will display the process.
Click the shape in the process where the Expression should be. In the Actions tab click on the PLUS sign at the bottom of the window and select the Expression option.
Me.EstimatedSolutionDate Example
There is another way to set a duration in the manual and user tasks, intermediate events and user timer with expression, i.e. by using the Me.EstimatedSolutionDate method. With this method, the user assigns the date in which the timer is going to be performed . For example, If an user inserts the date in which an appointment will be made (<Registration.FaceToFaceMeeting.InitialDate>), and he wants a timer to be executed one day before that date, one option to implement that is to create an expression. First, it is necessary to substract one day to the date previously inserted. It can be made by using the next sentence:
<Registration.FaceToFaceMeeting.Onedaytomeeting>=(Convert.ToDateTime(Convert.ToDateTime(<Registration.FaceToFaceMeeting.InitialDate>)).AddDays(-1));
Then, the date obtained is assigned as the solution date of the timer. Bizagi will calculate the time in minutes automatically.
Me.EstimatedSolutionDate=<Registration.FaceToFaceMeeting.Onedaytomeeting>;
Me.task Example
In this case, a form’s field is filled with the information obtained from the activity’s description, so that that information is displayed in the web application.
The activity´s description is configured in Properties in the Process Modeler.
To be able to show the description in the web, a form must contain the attribute. Drag and drop a text type attribute where the description will be saved.
Create a rule using Me.Task.Description, to set the text of the description to the attribute like shown in the picture.
Me.Assignee Example
This function is used to access information related to the users that are assigned.
When the function is used, an array of users is returned. To use the function it is necessary to use brackets in order to specify the index of the user. 0 (zero) is the first position of the array.
If there is only one user assigned, the sentence will be Me.Assignees[0].attribute
In this example the email address of the only user assigned will be returned.
First, evaluate if there is more than one user assigned, used the function Count.
Then, return the email address and save it to a variable that has already been declared.
IMPORTANT : When the activity has the "Everyone" assignation method, all the assigned users will appear in the result until the actual user press the Save or Next button.
In the next example the grid in the form shows all the assigned users for the actual activity.
When the user press the Save button, the grid shows the "admon" user because is the actual user and he is now the only assignee user.
The rule that fills the grid is on the OnEnter and OnSave of the activity. The next image shows the code of the expression.
Me.Case Example
In a Credit Request process, a bank must decide when to cash every loan request.
If the request date of any loan is after the 25th of each month (this is saved in a Constant Vocabulary), then the disbursement date will be changed to the 4th of the next month.
1. Create the attribute where the disbursement date will be saved.
2. Create two constant vocabularies: one to save the maximum disbursement date, and the disbursement date to chage to.
These vocabulary constants will be resolved with a function: CHelper.resolveVocabulary to obtain their value.
3. Create the rule to evaluate the date and change it if necessary
Me.Case.WorkingCredential Example
A bank has a business policy to make the Credit Request a more efficient process: when the request is created by a person who has a Disburser role, then the case does not need to go through the Credit Analysis activity.
In orther to skip the activity the attribute RequiresStudy was created. If the attribute is true, then the case will go through Credit Analysis. If it is false, the case will skip it.
The following rule evaluates if the current user has the Disburser role. If the user does have it, then the case does not need any further study.
Click on the link to access to another example for Me.Case.WorkingCredential
<comments />