Using the workflow function of iPLAss, you can create a flow that meets various requirements.
Here, we will explain how to create a workflow, divided into preparation, basic, and practice.
By studying the outline of the workflow in the preparation section, which is a brief explanation of the workflow in iPLAss; the operation and setting method of each event in the basic section; and the contents described in the practice section. The reader will be able to create realistic workflow to fit with their real business needs.
1. Prerequisite
This tutorial assumes the following condition was done: Before proceeding with the tutorial, do one of the following to prepare the environment where the Web application operates.
Some content can only be implemented with the Enterprise Edition.
To upgrade an open source version to Enterprise Edition, see Upgrade to Enterprise Edition.
2. Preparation Section
2.1. The Overview of WorkFlow
A workflow is a series of procedures for business standards and requirements. For example, the workflow can be as simple as "Employee applies for a time off, boss approves, employee confirms to receive the approval and takes the break times”.
This flow is shown below.

Each process segment is called a task. In addition to the tasks that require user’s involvements, there are also tasks that are automatically processed by the system. The flow is created by connecting these tasks with an arrow called a sequence flow. A workflow always has a starting event. Please verify these parts while playing with basics. Also refer to operation method for the specific method in details.
iPLAss workflows are composed by objects called workflow items. All the tasks described above are workflow items. Workflow items include Activity (Task), Event, Gateway, Flow, and Variable. By combining these items, you can assemble a workflow that meets various business requirements. The roles for each component is depicted as shown in the table below.
| Workflow Item | Role |
|---|---|
Activity (Task) | This represents the part of "Apply For Vacation" and "Approved by Supervisor" in the above figure. There are several other types as well. |
Event | This is the "Complete" part of the figure above. There are several other types as well. |
Gateway | Branch process logic decisive process and so on. This item is not shown above, but will be discussed later. |
Flow | This is the part corresponding to the arrows in flow chart above. |
Variable | Variable that stores necessary values for workflow execution. This item is not shown above, but will be discussed later. |
A simple explanation is given in the Description of each icon, but it is not necessary to throw everything to the readers here. The type of each item will be explained through the basics and practice sections. For the details of all items, see Workflow in the Developer Guide.
2.2. Method of Operation
Some operations are necessary to create objects for workflow with AdminConsole.
To start with the basic operations, please check the Tutorial(Basics).
Creating Workflow
Open AdminConsole, and right-click on Workflow like we did for Entity MetaData in previous tutorials, and click "Create Workflow".

Set any name of the MetaData in Name and click the "Save" button.

Edit WorkFlow
Double-clicking the created MetaData, an empty Workflow setting screen will be displayed.

Click the frame icon in the upper right with red square to toggle the light blue grid line.
Drag items from the left pane of the screen and drop to the center pane to assemble the workflow. Connect each item placed with SequenceFlow. SequenceFlow is adsorbed by dragging near the item to be connected. Be sure to connect firmly.

Click the target item to select it.
The setting properties of the selected item are displayed on the right side of the screen.
Click the × icon on the top right to delete the target item.
You can also delete by right-clicking the target item.

Right-clicking SequenceFlow not only allows you to "Delete item", it also has an option of "Change number of points". With 3Point, SequenceFlow can be folded and bent to fit complicated flows.

Task Overview
A task list overview is provided as a tool to check the status of the workflow being executed and the target data of the workflow. The task list is used to check the workflow completion and task execution history in both the basic and practical sections. Follow the steps below to make the task list displayable.
By default, the task list is set to not displayed. It is necessary to change this setting from TopView setting screen at AdminConsole.
The settings of TopView
Data called "DEFAULT" is registered in TopView of AdminConsole in advance.
The following screen will be displayed when double-clicking the node. Drag and drop "UserTaskList" in the "Workflow" folder in Items on the right side of the screen to the MainArea. "UserTaskList" will be added.

Settings of UserTaskList
The UserTaskList setting dialog is shown below. This time, we will set UserTaskView. Click the "UserTaskView Setting" tab to switch screens.
By default, all the display items are not checked. This time we want to see the workflow features such as the workflow history and the assignment status, so please check all of them.
Finally, click "OK" and click the "Save" button on the Topview itself to save the settings.
Check The Display
The task list is displayed on the top screen.
2.3. Explanation for Each Item
Activity(Task)
A task that can call iPLAss commands. Use this when you want to perform logical processing in a workflow.
This task assigns tasks to the specified users and distributes the processes based on the responsive result. By assigning a user who will set approval or denial in the response, the workflow can select and continue on corresponding subsequent process.
You can update the target Entity by specifying VariableItem, which will be explained later.
The task which define/specify the MailTemplate so to send mails.
It is possible to call a predefined Workflow as a SubProcess. This is not covered in this tutorial.
Event
This event is executed first when the workflow is started again. When this event is started, the workflow status becomes "Starting". One and only one start event must be defined for each workflow.
An event to end the workflow. The workflow status becomes to "COMPLETED" once reaching this event.
The event to log the workflow history. This event do nothing in particular, it just log the information and then proceeds to the subsequent flow.
This event has a timer function. You can specify the execution date and time and the execution delay time of subsequent events.
An event to cancel the workflow. The difference from EndEvent is the status after completion. When Termination is executed, the status of the Workflow becomes "CANCELED".
Gateway
Used in branching process. It will execute all subsequent Flows(All branches).
Used in branch processing. Execute one of the subsequent Flow. This will not covered in this tutorial.
Used in join process. Subsequent process is performed when one of the preceding process reaches this node. It is executed each time the previous process arrives.
Used in join processing. Subsequent processing is performed when all of the previous processing is completed.
Flow
It is used to link Activity (Task), Event, and Gateway items. Processes are executed in the order connected by SequenceFlow. Depending on the settings of the transition source Item, you can add conditions and branching processes.
Variable
You can store objects that are referenced in the Workflow. When starting a workflow from an entity, the registered entity data can be used in the workflow by using variableItems. Also, this variable must be configured to enable text messages during process execution and to decide whether buttons can be displayed.
3. Basic Section
At the basic section, the basic and fundamental features of the workflow will be discussed.Beware that some contents will be omitted to prevent redundancy.
3.1. Simple Approval
This section mainly explains how to use the basic functionality of UserTask. Consider a flow where a user registered data, and want someone to confirms and approve about it.

Preparation
Prepare an entity called basic.BasicWorkflowEntity001. There is no need to do anything about the property.
Workflow Settings
Create the MetaData of Workflow as follows.
| Item name | Setting value |
|---|---|
Name | basic/BasicWorkflow001 |
DisplayName | BasicWorkflow001 |
Description | Simple approval |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

We will Configure about each item. Setting is not required for items that are not listed. Set historyLoggin to true for all items to enable confirmation in the workflow history log.
VariableItem

Item name Setting value name
bwe001Variable
displayName
BWE001Variable
By setting the value of name to the variable when starting the workflow of EntityView, the data of the target Entity can be used in Workflow.
StartEvent

Item name Setting value name
bw001StartEvent1
displayName
BW001StartEvent1
historyLogging
true
UserTask

Item name Setting value name
bw001UserTask1
displayName
BW001UserTask1
historyLogging
true
assignRule
see assignRule below
taskResultStatus
see taskResultStatus below
assignRule
We will set assignRule. assignRule sets who processes this UserTask.
taskResultStatus
Set taskResultStatus. By setting taskResultStatus, it is possible to branch the process by approval or rejection. This time, use only approval.
Since branching is not necessary this time, only ok: approval is set. As shown below, the value set here is displayed as a button on the screen after starting the workflow.

EndEvent

Item name Setting value name
bw001EndEvent1
displayName
BW001EndEvent1
historyLogging
true
This completes the creation and configuration of Workflow Entity. Next part, we will configure to put the created WorkFlow to use.
This part, the process are necessary to put the WorkFlow to use.
DetailFormView settings
Perform the following settings for the created Entity: basic.BasicWorkflowEntity001. (It was mentioned in the beginning, if you forgot to create so, please create it now in order to proceed.)
Item name Setting value Workflow definition name
basic/BasicWorkflow001
Workflow variable name
bwe001Variable
Button display name
Start simple approval workflow
Message of running process
Simple approval workflow is running.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Register data in the corresponding Entity from the general search screen. The button "Start Simple Approval Workflow" is displayed as shown on the left. This button is the button with the name set in EntityView. Clicking this button starts the workflow.

At the same time as the workflow start message, a message indicating that the process set in EntityView is "in progress" will be displayed.
When you check the task list on the home screen, assignments are made based on Workflow assignRule.

It will operate the assigned UserTask and try the approval process. Click the "Edit" link in the task list. The following figure is displayed. Enter comments if necessary and click the "Approve" button. This “Approve” button is the value set in the taskResultStatus of Workflow.

When the approval was made, this screen will reloads. Let’s check each item. See if the process is completed.

Above all, is a simple approval workflow.
3.2. Send Back
Now we will explain how to use branch process that use the result of UserTask. It is so-called NG. A user registers the data and makes an application. The approver checks the data and approves if there is no problem and reject it back if there is a problem.

Advance preparation
Prepare an entity named basic.BasicWorkflowEntity002. There is no need to do anything about the property.
Please prepare an account called user001@tenantName.(If you followed other tutorials, please beware to remove/clean previous created users and roles. They will interfere.)
Workflow Settings
Create Workflow MetaData as follows.
| Item name | |
|---|---|
name | basic/BasicWorkflow002 |
displayName | BasicWorkflow002 |
description | Send back |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

We will configure about each item. Setting is not required for item that are not listed. The items described in "Simple approval" will be omitted. Such as set name, displayName, historyLoggin, item namings etc. Please be careful with name of Variable item, beware to use the name you defined when there is settings related to the Variable Items.
Prepare user001@tenantName in addition to admin@tenantName.
UserTask (BW002UserTask1)

Item name Setting value assignRule
See assignRule below
taskResultStatus
See taskResultStatus below
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
user001@tenantName
taskResultStatus
Item name Setting value name
post
displayName
Apply
UserTask (BW002UserTask2)

Item name Setting value assignRule
See assignRule below
taskResultStatus
See taskResultStatus below
assignRule
Item name
Setting value
Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
This time, you need to register an approval button and a send back button.Item name Setting value name
ok
displayName
Approve
Item name Setting value name
ng
displayName
Send back
If the settings are correct, the status will be as shown below.

SequenceFlow (BW002UserTask2 → BW002EndEvent1)

This is the flow for approval.
Item name Setting value nodeResultStatus
ok
SequenceFlow (BW002UserTask2 → BW002UserTask1)

This is the flow for sending back.
Item name Setting value nodeResultStatus
ng
Now we will work on to prepare the the workflow created in previous sections to use in GEM. Please open the entity detail layout of basic.BasicWorkflowEntity002, the entity we created at the beginning. Click the setting button of Detail Screen like we did to previous "simple approval" example.
DetailFormView settings
Item name Setting value Workflow definition name
basic/BasicWorkflow002
Workflow variable name
bwe002Variable
Button display name
Return workflow activation
Message of Running Process
Send-back workflow is running.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Log in with the admin account and start the workflow in the same way as "simple approval" approval.
Check your workflow as you would for a "simple approval" approval.
Log back in with the user001 account and go to the task processing edit screen. It will be in the state that you can apply, so please click the Apply button.

Please log in again with the admin account after completing the application. An approval request for the task that has been applied for is received in the task list. Click the edit link to approve and send back.

This time, two buttons, "Approve" and "Send back" will be displayed. It is expected to be used in such a way as to check the task target data and check the data for approval. Click "send back" here.

When you have finished sending back, log in again with the user001 account and confirm that the task that was sent back and is in the task list. Click the edit link and apply again.

Please log in again with the admin account after reapplying. An approval request for the task that has been applied for is received in the task list. Click the edit link to approve and send back. Let’s approve this time.
If you check the workflow history after approval, you will see the following figure.

The above is the Workflow for sending back.
3.3. Send Email Upon Approval
This section mainly explains how to send email. Imagine such situation, the user registered the data and applied the approval workflow, now he also want to send an email to the on-duty user to remind about the workflow.

Preparation
Prepare an entity named basic.BasicWorkflowEntity003. There is no need to do anything about the property.
Prepare a MailTemplate called basic/SimpleWorkflow003. Enter an arbitrary string for the subject and message.
You need to configure service-config only if you want to check the mail locally. Please enable the corresponding listener for MailService.
Workflow settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | basic/BasicWorkflow003 |
displayName | BasicWorkflow003 |
description | Send email |
Show the created workflow and modify it to the workflow shown below. Refer to operation method for specific operations.

Settings for each item Set each item. Setting is not required for item that are not listed. The items described so far are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask (BW003UserTask1)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name Setting value name
ok
displayName
Request and send
MailTask (BW003MailTask1)

Item name Setting value mailTemplateName
basic/SimpleWorkflow003
to
refer below
to
Set the destination. This time, since we are not actually going to send the mail, we only want to confirmed in the log, set "test@test.jp".
This completes the creation and configuration of Workflow Entity. Next part, we will configure to put the created WorkFlow to use.
We will perform the process that are necessary to put the WorkFlow to use.
DetailFormView settings
Item name Setting value Workflow definition name
basic/BasicWorkflow003
Workflow variable name
bwe003Variable
Button display name
start email sending workflow
Message of running process
E-mail sending workflow is being executed.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Log in with the admin account and start the workflow in the same way as "simple approval" approval.
Check your workflow as you did for previous "simple approval".
Click the "Send Approval" button. The workflow is completed and an email is sent. In the local environment, the mail contents are logged to the Eclipse console.(It may be in one line so be careful when looking for it.)

11:32:33.257 [http-nio-8080-exec-1] DEBUG 38 63312 CompositeCommand o.i.m.m.l.LoggingSendMailListener - From:test@contract.isid.co.jp ReplyTo:test@contract.isid.co.jp To:(1)test@test.jp; Cc:(0) Bcc:(0) Subject:Mail Sample FileName: PlainMessage:MailSample HtmlMessage:
The above is the Workflow that includes the email transmission process.
3.4. Entity Operation While Performing Approval
This section mainly explains the entity operation method. Image the need to update Entity data at the same time when a user registered the data and made an request.

Preparation
Prepare an entity named basic.BasicWorkflowEntity004. There is no need to do anything about the property.
Workflow settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | basic/BasicWorkflow004 |
displayName | BasicWorkflow004 |
description | Entity operation |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

Set each item. Setting is not required for item that are not listed. Beware that the items have been explained above are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask (BW004UserTask1)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name Setting value name
ok
displayName
Approve and update
UpdateEntityTask (BW004UpdateEntityTask1)

Item name Setting value variableName
bwe004Variable
updateRule
see updateRule
updateRule
When this workflow is executed and completed normally, the description of the target data will be updated with the desired value.
This completes the creation and configuration of Workflow Entity. Next part, we will configure to put the created WorkFlow to use.
We will perform the process that are necessary to put the WorkFlow to use.
DetailFormView settings
Item name Setting value Workflow definition name
basic/BasicWorkflow004
Workflow variable name
bwe004Variable
Button display name
Activate Entity operation workflow
Message of running process
The Entity operation workflow is being executed.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Log in with the admin account and start the workflow like what you did with "simple approval" workflow in previous sections.
Check your workflow as you would for a “simple approval” approval.
Let’s check the data before update from the target data link. You can see that the description item is empty. Click on the "Update Approval" button.

Make sure that it is updated after the workflow is complete.
The above is the workflow that includes Entity operations.
3.5. Custom Logic Process With Approval
This section mainly explains how to use custom logic. Imagine the needs for the situation that the custom logic is triggered when the user registers the data and makes an request.

Preparation
Prepare an entity called basic.BasicWorkflowEntity005. There is no need to do anything about the property.
Prepare a command called basic/BasicWorkflowCommand005. The code only outputs a log as follows:

System.out.println("### Executed BasicWorkflowCommand005.");Workflow Settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | basic/BasicWorkflow005 |
displayName | BasicWorkflow005 |
description | Custom logic processing |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

Set each item. Setting is not required for item that are not listed. The items explained previously are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask (BW005UserTask1)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name Setting value name
ok
displayName
Approve and initiate custom process
CommandTask (BW005CommandTask1)

Item name Setting value commandConfig
basic/BasicWorkflowCommand005
This completes the creation and configuration of Workflow Entity. Next part, we will configure to put the created WorkFlow to use.
We will perform the process that are necessary to put the WorkFlow to use.
DetailFormView settings
Item name Setting value Workflow definition name
basic/BasicWorkflow005
Workflow variable name
bwe005Variable
Button display name
Custom logic processing workflow launcher
Message of running process
Custom logic processing workflow is running.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Log in with the admin account and start the workflow in the same way as what you did with "simple approval" at previous sections.
Check your workflow as you would for a “simple approval” approval.
Click the "Approve and initiate Custom Process" button.

Check the app log and confirm that the command has been executed.

This is the workflow that includes custom logic processing.
3.6. Split
This section mainly explains how to use Gateway (Split). Imagine the needs for the situation that an email is sent and the application task for that data is triggered at the same time when a user registered the data. And end the application task once it is executed.

Preparation
Prepare an entity named basic.BasicWorkflowEntity006. There is no need to do anything about the property.
Workflow Settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | basic/BasicWorkflow006 |
displayName | BasicWorkflow006 |
description | Split |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

Set each item. Setting is not required for item names that are not listed. The items described so far are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask (BW006UserTask1)

Item name Setting value assignRule
referring assignRule
taskResultStatus
referring taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name Setting value name
post
displayName
Apply
MailTask (BW006MailTask1)

Item name Setting value mailTemplateName
basic/SimpleWorkflow003
to
Definition format: string
to acquisition logic: test@test.jp
This completes the creation and configuration of Workflow Entity. Next part, we will configure to put the created WorkFlow to use.
We will perform the process that are necessary to put the WorkFlow to use.
DetailFormView settings
Item name Setting value Workflow definition name
basic/BasicWorkflow006
Workflow variable name
bwe006Variable
Button display name
Split workflow activation
Message of running process
Split workflow is running.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Log in with the admin account and start the workflow in the same way as what you did in "simple approval" approval sections. Confirm that an e-mail is sent at the same time as the workflow was started
Check your workflow as you would like previous “simple approval” approval workflows.
Click the "Branch and Apply" button.

Check from the workflow history that all the branched flows are executed.(Make sure the corresponding logging settings are set to true for those workflow items.)

The above is a workflow that includes splits.
3.7. timer
This section mainly explains how to use Timer. The situation is, we want the mail to be sent after a few minutes when a user registered the data and received approval.

Preparation
Prepare an entity named basic.BasicWorkflowEntity007. There is no need to operate the property.
Setting is required for service-config. Set useQueue to true as shown below.
<!-- AsyncTask queue and counter setting -->
<service>
<interface>org.iplass.mtp.impl.async.rdb.RdbQueueService</interface>
<!-- if use async rdb service set to true -->
<property name="useQueue" value="true" />
</service>Workflow Settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | basic/BasicWorkflow007 |
displayName | BasicWorkflow007 |
description | Timer |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

Set each item. Setting is not required for item that are not listed. The items explained above are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask (BW007UserTask1)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name
Setting value
name
post
displayName
Email 3 minutes after applying
IntermediateTimerEvent (BW007IntermediateTimerEvent1)

Item name Setting value Timer Type
Delay
Timer Unit
MINUTES
Delay Expression
"3"
MailTask (BW007MailTask1)

Item name Setting value mailTemplateName
basic/SimpleWorkflow003
to
Definition format: string
to acquisition logic: test@test.jp
This completes the creation and configuration of Workflow Entity. Next part, we will configure to put the created WorkFlow to use.
We will perform the process that are necessary to put the WorkFlow to use.
DetailFormView settings
Item name Setting value Workflow definition name
basic/BasicWorkflow007
Workflow variable name
bwe007Variable
Button display name
Timer workflow start
Message of running process
Timer workflow is running.
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Log in with the admin account and start the workflow in the same way like what you did with previous "simple approval" approval workflow.
Check your workflow like what you did for previous "simple approval" approval workflow.
Click the "Email after 3 minutes" button.

Make sure that the email is sent in 3 minutes.

This concludes the end of the basic workflow that includes a timer.
4. Practical Section
In the practical section, we will assemble complicated processes by combining multiple workflow functions.
4.1. Inquiry
Imagine such workflow to deal with customer inquiry: When the inquiry comes, start a workflow and assign the employee to respond, and then let the superior to approve the result. The simple flow is as follows.

Preparation
Prepare an entity named practice.PracticeWorkflowEntity001. The values to be set are as follows.

| Name | DisplayName | Type | |
|---|---|---|---|
inquiryNo | Inquiry number | AutoNumber | Format: in-${yyyy}${MM}-${nextVal()} |
familyName | Last Name | String | |
firstName | First Name | String | |
familyNameReading | Last Name Reading | String | |
firstNameReading | First Name Reading | String | |
String | |||
content | Content | LongText | |
topic | type | Select | LocalValue: |
inquiryStatus | Query Status | Select | LocalValue: |
Please also configure the event listener as depicted below.

import java.util.LinkedHashMap;
import java.util.Map;
import org.iplass.mtp.workflow.WorkflowManager;
def wm = manager(WorkflowManager.class);
Map<String, Object> parameters = new LinkedHashMap<String, Object>();
parameters.put("pwe001Variable", entity);
wm.startProcess("practice/PracticeWorkflow001", parameters);With this setting, Workflow will automatically starts after registering data in Entity.
Please prepare the following accounts.
user001@tenantName
user002@tenantName
user003@tenantName
Workflow Settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | practice/PracticeWorkflow001 |
displayName | PracticeWorkflow001 |
description | Query Management |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

We are going set each item. Setting is not required for item that are not listed. The items cover above are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask(PW001UserTask1)

Item name Setting value assignRule
referring assignRule
taskResultStatus
referring taskResultStatus
userTaskName
respond the inquiry:${pwe001Variable.inquiryNo}
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition Format
EQL
ID acquisition logic
state = 'V'
taskResultStatus
Item name Setting value name
OK
displayName
Done
UpdateEntityTask (PW001UpdateEntityTask1)

Item name Setting value variableName
pwe001Variable
updateRule
Type: property
Property name: inquiryStatus
Updated value: 3
UserTask (PW001UserTask2)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
userTaskName
Approval for inquiries:${pwe001Variable.inquiryNo}
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ANYONE
Completion Conditions
ANYONE
Definition Format
EQL
ID acquisition logic
state = 'V'
taskResultStatus
Item name Setting value name
OK
displayName
Approve
Item name Setting value name
NG
displayName
Send back
SequenceFlow (PW001UserTask2 → PW001UpdateEntityTask3)

This is the flow for approval.
Item name Setting value nodeResultStatus
OK
SequenceFlow (PW001UserTask2 → PW001UpdateEntityTask2)

This is the flow for sending back.
Item name Setting value nodeResultStatus
NG
UpdateEntityTask (PW001UpdateEntityTask2)

Item name Setting value variableName
pwe001Variable
updateRule
Type: property
Property name: inquiryStatus
Updated value: 2
UpdateEntityTask (PW001UpdateEntityTask3)

Item name Setting value variableName
pwe001Variable
updateRule
Type: property
Property name: inquiryStatus
Updated value: 4
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Workflow is started by registering data in the target Entity.
Check your workflow like we did in previous "simple approval” approval examples.
Register some data to begin with.

Confirm that it is registered in MY task.

Click the "Done" button to complete the inquiry.

It will disappear in MY task. Select "Created Task".

You can see that this user is not in charge anymore.

Log in as the person in charge and perform task processing.

The above is the query management management workflow.
4.2. Delivery Management
Create a workflow to perform the allocation process using the queue.

preparation
Prepare an entity named practice.PracticeWorkflowEntity002. The values to be set are as follows.

| Name | DisplayName | Type | |
|---|---|---|---|
settlementNo | Request Number | AutoNumber | Format:se-${yyyy}${MM}-${nextVal()} |
settlementStatus | Request Status | Select | LocalValue: |
deliverGoodsDate | Expected Delivery Date | Date | |
orderMail | String |
Please set the listener as follows.

import java.util.LinkedHashMap;
import java.util.Map;
import org.iplass.mtp.workflow.WorkflowManager;
def wm = manager(WorkflowManager.class);
Map<String, Object> parameters = new LinkedHashMap<String, Object>();
parameters.put("pwe002Variable", entity);
parameters.put("orderMail", entity.orderMail);
wm.startProcess("practice/PracticeWorkflow002", parameters);With this setting, Workflow will automatically starts after registering data in Entity.
We will use UserTaskQueue for this example. It is necessary to register data beforehand. Please specify and create data in the name and code of the entity called mtp.workflow.UserTaskQueue provided by iPLAss
practiceWorkflowQueue002
Beware that Mtp.workflow.UserTaskQueue is not registered in the menu. So it is necessary to register it to the menu.
Please prepare the following accounts.
user001@tenantName
user002@tenantName
user003@tenantName
Prepare the following two MailTemplates.
practice/PracticeWorkflow002_001

practice/PracticeWorkflow002_002

Prepare the following command.
practice/PracticeWorkflowCommand002

import org.iplass.mtp.entity.UpdateOption;
import org.iplass.mtp.entity.SelectValue;
import org.iplass.mtp.impl.core.ExecuteContext;
def settlement = request.getAttribute("pwe002Variable");
//Request status
settlement.setValue("settlementStatus", new SelectValue("2"));
// Estimated delivery date
settlement.setValue("deliverGoodsDate", ExecuteContext.getCurrentContext().getCurrentTimestamp());
UpdateOption option = new UpdateOption(false);
option.setUpdateProperties("settlementStatus", "deliverGoodsDate");
em.update(settlement, option);Workflow Settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | practice/PracticeWorkflow002 |
displayName | PracticeWorkflow002 |
description | Shipping Management |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

Please set the properties for each item. Setting is not required for items that are not listed. The items explained previously are omitted. Set name, displayName, historyLoggin, etc. as necessary.
VariableItem

Item name Setting value name
orderMail
displayName
OrderMail
※ This time, VariableItem is used separately from EntityData in order to retain the mail transmission destination.
MailTask (PW002MailTask1)

Item name
Setting value
mailTemplateName
practice/PracticeWorkflow002_001
to
Definition format: script
to acquisition logic: orderMail
UserTask (PW002UserTask1)

Item name Setting value assignRule
referring assignRule
taskResultStatus
referring taskResultStatus
userTaskName
Delivery Processing: ${pwe002Variable.settlementNo}

assignRule
Item name Setting value Type
ToQueue
Apply flow name
*
Allocation type
ANYONE
Completion Conditions
ANYONE
QueueCode acquisition logic
return "practiceWorkflowQueue002";
We will set assignRule like we did before. This time we will use Queue. Set as shown below.

Note that if the UserTaskQueue mentioned in preparation works for this workflow is not completed, an error will occur when executing the workflow.
taskResultStatus
Item name Setting value name
OK
displayName
Delivery Completed
Item name Setting value name
NG
displayName
Undeliverable
SequenceFlow (PW002UserTask1 → PW002CommandTask1)

This is the flow for approval.
Item name Setting value nodeResultStatus
OK
SequenceFlow (PW002UserTask1 → PW002UpdateEntityTask1)

This is the flow for sending back.
Item name Setting value nodeResultStatus
NG
UpdateEntityTask (PW002UpdateEntityTask1)

Item name Setting value variableName
pwe002Variable
updateRule
Type: property
Property name: settlementStatus
Updated value: 3
CommandTask (PW002CommandTask1)

Item name Setting value commandConfig
practice/PracticeWorkflowCommand002
MailTask (PW002MailTask2)

Item name Setting value mailTemplateName
practice/PracticeWorkflow002_002
to
Definition format: script
to acquisition logic: orderMail
Up to this point, you are ready to use this Workflow. Let’s try it from the next section.
Using Workflow
Workflow will be initiated by registering data in the target Entity.
Check your workflow as you did for previous "simple approval" approval examples.
Please register the data.

An email will be sent at the same time as the data registration.
Check the created task.

Since the assignment is not a user but a task queue this time, it will not automatically be listed in the MY task. Assign the target task from all tasks.

If you look at the MY task, you can see that it is already assigned.

Perform task processing.

Click on Delivery Complete this time. An email will be sent upon completion.

The above is all for the delivery management workflow.
4.3. Minutes Approval
Imagine this situation: The designer want to use the data lock function to prevent changes once the minutes are approved.

In the flow with notification, the mail sending task is executed after the task is completed.
Preparation
Prepare an entity named practice.PracticeWorkflowEntity003. The values to be set are as follows.

| Name | DisplayName | Type | |
|---|---|---|---|
minutes | Minutes | Binary | |
members | Circulation Destination | Reference | Reference destination: User |
authorizerList | Authorizer List | Binary |
Please prepare the following accounts.
user001@tenantName
user002@tenantName
user003@tenantName
Please prepare the following five MailTemplates.
practice/PracticeWorkflow003_001 (Notice of minutes submission)
practice/PracticeWorkflow003_002 (Notification of approval/disapproval request)
practice/PracticeWorkflow003_003 (Approval notice)
practice/PracticeWorkflow003_004 (Notification of rejection)
practice/PracticeWorkflow003_005 (Completion notice)
Set the subject and content as desired.
Prepare the following command.
practice/PracticeWorkflowCommand003_001 (automatic approval process)
It is a process to automatically setting the target registered in the to "approve" even if "not approved" for a certain period (timer setting). This command is executed when the period set by the timer has passed.
import org.iplass.mtp.entity.query.Query;
import org.iplass.mtp.entity.query.condition.predicate.Equals;
import org.iplass.mtp.entity.EntityManager;
import org.iplass.mtp.entity.SearchResult;
import org.iplass.mtp.entity.SelectValue;
import org.iplass.mtp.entity.UpdateOption;
import org.iplass.mtp.workflow.Assignment;
import org.iplass.mtp.workflow.UserTask;
System.out.println("### START PracticeWorkflowCommand003_001");
// Retrieve the Workflow oid from the context
def workflowId = request.workflowInstanceId;
// Generate the definitionKey of UserTask(Workflow definition name + Usertask name + workflow ID)
def definitionKey = "practice/PracticeWorkflow003-" + "pw003UserTask3-" + workflowId;
// get UserTask
Query taskQuery = new Query()
.selectAll("mtp.workflow.UserTask", false, false)
.from("mtp.workflow.UserTask").where(new Equals("definitionKey", definitionKey));
UserTask userTask = (UserTask) em.searchEntity(taskQuery).getFirst();
String userTaskOid = userTask.getOid();
// get Assignment from UserTask.oid
Query assignmentQuery = new Query()
.selectAll("mtp.workflow.Assignment", false, false)
.from("mtp.workflow.Assignment")
.where(new Equals("task.oid", userTaskOid));
SearchResult<Assignment> assignment = em.searchEntity(assignmentQuery);
for (Assignment e : assignment) {
String assignState = e.getAssignState().getValue();
System.out.println("assignState : " + assignState);
// Update all assignments which no action were taken to Completed
if ("ASSIGNED".equals(assignState)) {
UpdateOption option = new UpdateOption();
option.setUpdateProperties("assignState", "taskResult", "comment");
e.setAssignState(new SelectValue("COMPLETED"));
e.setComment("Automatic Approval");
e.setTaskResult("ok");
em.update(e, option);
}
}practice/PracticeWorkflowCommand003_002(Approver list generation process)
Acquire only "Approved" users (including automatic approval) and then create a CSV file. It is also the process of registering the created file in the minutes workflow entity.
import org.iplass.mtp.entity.query.Query;
import org.iplass.mtp.entity.query.condition.predicate.Equals;
import org.iplass.mtp.entity.BinaryReference;
import org.iplass.mtp.entity.EntityManager;
import org.iplass.mtp.entity.SearchResult;
import org.iplass.mtp.entity.UpdateOption;
import org.iplass.mtp.workflow.Assignment;
import org.iplass.mtp.workflow.UserTask;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.IOException;
System.out.println("### PracticeWorkflowCommand003_002");
// Get wokrflow oid from context
def workflowId = request.workflowInstanceId;
System.out.println("### worflowId : " + workflowId);
// Generate the definitionKey of UserTask(Workflow definition name + Usertask name + workflow ID)
def definitionKey = "practice/PracticeWorkflow003-" + "pw003UserTask3-" + workflowId;
// get UserTask
Query taskQuery = new Query()
.selectAll("mtp.workflow.UserTask", false, false)
.from("mtp.workflow.UserTask")
.where(new Equals("definitionKey", definitionKey));
UserTask userTask = (UserTask) em.searchEntity(taskQuery).getFirst();
String userTaskOid = userTask.getOid();
// Get Assignment from UserTask.oid
Query AssignmentQuery = new Query()
.selectAll("mtp.workflow.Assignment", false, true)
.from("mtp.workflow.Assignment")
.where(new Equals("task.oid", userTaskOid));
SearchResult<Assignment> assignment = em.searchEntity(AssignmentQuery);
// Approver list generation
def authorizerList = "";
for (Assignment e : assignment) {
if ("ok".equals(e.taskResult)) {
authorizerList = authorizerList + e.user.name + "\r\n";
}
}
// Create InputStream to use BinaryReference from Approver information String
InputStream is = new ByteArrayInputStream(authorizerList.getBytes());
// create BinaryReference
BinaryReference br = em.createBinaryReference("approverList.csv", "text/csv", is);
// Streamをclose
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
// operation on Entity
def entity = request.getAttribute("pwe003Variable");
entity.setValue("authorizerList", br);
// update
UpdateOption option = new UpdateOption();
option.setUpdateProperties("authorizerList");
em.update(entity, option);practice/PracticeWorkflowCommand003_003(freeze)
This process locks the registered minutes, circulation user, and approver list so that they cannot be updated.
import org.iplass.mtp.entity.query.Query;
import org.iplass.mtp.entity.query.condition.predicate.Equals;
import org.iplass.mtp.entity.EntityManager;
import org.iplass.mtp.entity.UpdateOption;
System.out.println("### PracticeWorkflowCommand003_003");
// Get workflow oid from context
def workflowId = request.workflowInstanceId;
// Get WorkflowTarget from workflowId
Query workflowTargetQuery = new Query()
.select("targetEntityOid")
.from("mtp.workflow.WorkflowTarget")
.where(new Equals("workflow.oid", workflowId));
def workflowTarget = em.searchEntity(workflowTargetQuery).getFirst();
// Entities to be freezed
def entity = em.lockByUser(workflowTarget.targetEntityOid, "practice.PracticeWorkflowEntity003");Workflow Settings
Create Workflow MetaData as follows.
| Item name | Setting value |
|---|---|
name | practice/PracticeWorkflow003 |
displayName | PracticeWorkflow003 |
description | Meeting Approval |
Display the created workflow and create the workflow shown below. Refer to operation method for specific operations.

Let’s set the property for each item. Setting is not required for items that are not listed. The items explained previously are omitted. Set name, displayName, historyLoggin, etc. as necessary.
UserTask (PW003UserTask1)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ANYONE
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name Setting value name
post
displayName
Submit minutes
MailTask (PW003MailTask1)

Item name Setting value mailTemplateName
practice/PracticeWorkflow003_001
to
Definition format: STRING
to get logic: any address
UserTask (PW003UserTask2)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
ANYONE
Definition format
STRING
ID acquisition logic
admin@tenantName
taskResultStatus
Item name Setting value name
memberset
displayName
circulation destination set
Item name Setting value name
ngminutes
displayName
Return the minutes
MailTask (PW003MailTask2)

Item name Setting value mailTemplateName
practice/PracticeWorkflow003_002
to
Definition format: STRING
to get logic: any address
IntermediateTimerEvent (PW003IntermediateTimerEvent1)

Item name Setting value Timer Type
Delay
Timer Unit
Minuites
Delay Expression
"3"
CommandTask (PW003CommandTask1)

Item name Setting value commandConfig
practice/PracticeWorkflowCommand003_001
UserTask (PW003UserTask3)

Item name Setting value assignRule
See assignRule
taskResultStatus
See taskResultStatus
assignRule
Item name Setting value Type
ById
Apply flow name
*
Allocation type
ALL
Completion Conditions
VOTE
Definition Format
SCRIPT
ID acquisition logic
See code below
Obtaining account ID set in members of the target Entity.
import org.iplass.mtp.entity.query.Query; import org.iplass.mtp.entity.query.condition.predicate.Equals; import org.iplass.mtp.entity.EntityManager; Query membersQuery = new Query() .select("members.accountId") .from("practice.PracticeWorkflowEntity003") .where(new Equals("oid", pwe003Variable.oid)); def em = manager(EntityManager.class); def members = em.searchEntity(membersQuery).getList(); def result = []; int cnt = 0; for (def e : members) { System.out.println(e.members.accountId); result[cnt] = e.members.accountId; cnt ++; } return result;taskResultStatus
Item name Setting value name
OK
displayName
Approve
Item name Setting value name
NG
displayName
Reject
MailTask (PW003MailTask3)

Item name Setting value mailTemplateName
practice/PracticeWorkflow003_003
to
Definition format: STRING
to get logic: any address
MailTask (PW003MailTask4)

Item name Setting value mailTemplateName
practice/PracticeWorkflow003_004
to
Definition format: STRING
to get logic: any address
CommandTask (PW003CommandTask2)

Item name Setting value commandConfig
practice/PracticeWorkflowCommand003_002
CommandTask (PW003CommandTask3)

Item name Setting value commandConfig
practice / PracticeWorkflowCommand003_003
MailTask (PW003MailTask5)

Item name Setting value mailTemplateName
practice/PracticeWorkflow003_005
to
Definition format: STRING
to get logic: any address
SequenceFlow (PW003UserTask2 → PW003UserTask1)

This is the flow for sending back.
Item name Setting value nodeResultStatus
ngminutes
SequenceFlow(PW003UserTask3 → PW003MailTask4 → PW003UserTask2)

The flow for send back
Item name Setting value nodeResultStatus
NG
SequenceFlow (PW003UserTask3 → PW003MailTask3)

Item name Setting value nodeResultStatus
OK
From here, it will the prerequisite works so to use the workflow created in the previous operation.
DetailFormView settings
Item name Setting value Workflow definition name
practice/PracticeWorkflow003
Workflow variable name
pwe003Variable
Button display name
Minute workflow launch
Message of running process
The minutes workflow is running.
Up to this point, you are ready to use this Workflow. Let’s use Workflow in the next section.
Using Workflow
Register data in practice.PracticeWorkflowEntity003 entity and start the workflow.

Check your workflow as you would for a "simple approval" approval.
Register and submit the minutes.

You will be notified by email when you click the "Submit minutes" button.
Register the circulation destination and execute the circulation destination set. As with the registration of the minutes, select the circulation destination in the target data editing and save. The user set here becomes the approver/denier.

You will be notified by email when you click the “Set Circulation Address” button.
Approve the record with the specified user or wait for the time set by the timer. An email notification will be sent when the approval judgment is completed.
When the workflow is complete, verify that the approver list is registered and locked.

The above is the minutes approval workflow.
5. Next step
If you want to know the very details about the workflow mentioned in this tutorial, please refer to the Developer Guides of Workflow.
If you want to understand the details of other features, please refer to the content list of the Developer Guide and modify the definitions according to the requirements of your specific situations.