Examples

18.8. Examples

Sequential Process #

A sequential process means that when one activity is completed the next activity becomes available.

In this example, we have a process with two tasks.

The first task is to create a new bank account.

The second task is to approve the new bank account.

The Activity Tree may look like this:

P1_Activity_Tree_sent20170314.png

A bank account is created on a Business Partner, so the first task’s Start Action must be ‘Open Business Partner’.

2_start_action_open_business_partner.png

To open the wanted business partner, the business partner identifier must be given as input data when the process is started

P3_Input_Data_sent20170314.png

The second task will also have Start Action ‘Open Business Partner’. To make sure that the owner of the second task opens the same business partner, the input value can be set up as an expression that tells the system to open the same business partner as the one opened on the first task.

Example of expression:

task.previousTask.inputDataFieldValue(‘businessPartnerId’)

3_approve_bank_account.png

If both tasks are assigned to a Task Management user group, e.g. ‘Accountants’, the first task is made available to all users belonging to this group(status ‘Ready’).

The user who approves the bank account cannot be the same user that created the bank account.

The potential owner of the second task can be set up to be the same group as on the first task (i.e. ‘Accountants’),except the user who executed the first task (the actual owner of the first task).

Example of expression: activity.previousTask.potentialOwnersAsUsers.copyWithout(activity.previousTask.actualOwner)

4_potential_owners.png

When the process is completed, you may want to send an e-mail to the person who started the process, i.e. the process initiator or actual owner of the process.

Example of expression:

process.actualOwner

5_event_actions.png

Conditional Logic Process #

A conditional logic sub process will either be repeated until a condition is met

(“While” process) or will choose between tasks depending on a condition (“If-Then-

Else” sub process).

Both these sub processes need an expression where the condition to be tested is specified.

We want to create a process with the following steps:

  1. Create new Claim Worksheet
  2. While process - Verify Claim Worksheet(repeated until the Claim Worksheet is approved)
  3. If
  • -Then-Else process If worksheet is approved

Then - close Claim Worksheet and complete process

Else - send back to the owner of the first task for correction

P7_Activity_Tree_2_sent20170314.png

Create Worksheet - createClaimWorksheet #

Start action is to open the claim for which the worksheet should be created - Claim identifier must be given as input data once process is started

P8_Start_Action_Task1_sent20170314.png

The output data is worksheet identifier of the created worksheet

While (Approval) - whileApproval #

An expression is needed to make sure that the while sub process is repeated until the worksheet is approved.

P9_WhileSubProcess1_sent20170314.png

Example of expression:

process.getActivity(‘whileApproval’).outputDataFieldValue(‘Approved’) != ‘Yes’

This expression will the test the answer to the question if worksheet is approved or not(the dialog box set up is shown below).

If the answer is ‘No’(i.e. different from ‘Yes’), the while sub process is repeated.

If the answer is ‘Yes’ the process continues to next activity.

Note that ‘whileApproval’ is the internal name of the While sub process, as defined under General Properties.

Verify Worksheet - verifyWorksheet #

Assume that the potential owner assignment of the first task (Create Worksheet) is as a group, called e.g. ‘Accountants’.

You want a person from the same group to verify the worksheet, but not the same user who created the worksheet.

This can be achieved by assigning the ‘Verify Worksheet’ task to the same group/potential owners, but exclude the person who created the worksheet (the actual owner of the first task, create worksheet).

P10_Assignment_rule_sent20170314.png

Example of expression:

process.getActivity(‘createClaimWorksheet’).potentialOwnersAsUsers.copyWithout(actualOwner)

This expression will make this task available for all users in the group ‘Accountants’, except the user who created the worksheet (i.e. the actual owner of task ‘createClaimWorksheet’).

Start action is ‘Open Worksheet’and input data for this start action is ‘worksheetId’.

To make sure the correct worksheet is opened, an Input Data field expression is created referring to the worksheet created in ‘Create Worksheet’

P11_Input_Data_task_2_sent20170314.png

Example of expression:

process.getActivity(‘createClaimWorksheet’).outputDataFieldValue(‘worksheetId’)

When the verification of the worksheet is completed, i.e. task is completed, the worksheet is either ‘Approved’or ‘Rejected’.

An Event Action was set to be executed upon completion of the verification task. In this example, a dialog box is returned.

P12_Dialog_box_newTask2_sent20170314.png

Running the process, the dialog box will look like this:

P13_Dialog_box_sent20170314.png

Depending on the user’s selection in the dialog box, the output data field ‘Approved’ on the While sub process will be set to ‘Yes’or ‘No’.

If (Approved) - ifApproved #

This sub process needs an expression to decide how the process should continue.

The expression tests the result of the while sub process, i.e. if the worksheet is approved (‘Yes’ - Approved) or not (‘No’ - Rejected).

Example of expression:

process.getActivity(‘whileApproval’).outputDataFieldValue(‘Approved’) = ‘Yes’

P14_IfThenElseSubProcess2_sent20170314.png

[Then] Close Worksheet - closeWorksheet #

If the worksheet is approved, then the next step is to close the worksheet.

Potential owners of this task can be a specific user, a group or decided by an assignment rule - see above.

The start action should be ‘Open Worksheet’

When the worksheet is closed, the process is completed. The person who first started the process may want to be notified when the entire process is completed, e.g. by receiving an eMail. For this an event action is set up.

Example of expression for recipient(s) of the eMail:

process.actualOwner

P15_Notification_sent20170314.png

[Else] Correct Worksheet - correctWorksheet #

If the worksheet is ‘Rejected’ (i.e. not approved), the worksheet needs to be updated/corrected.

The start action is ‘Open Worksheet’ and input data is worksheetId - as before

If you want to return the worksheet to the person who first created it, you can define the potential owner as an expression:

Example of expression:

process.getActivity(‘createClaimWorksheet’).actualOwner

P16_Correct_WS_owner_sent20170314.png

When completing the correction task, the While sub process will execute again. Since ‘Approval’is still not ‘Yes’, the worksheet is sent to verification again - ‘Verify Worksheet’.