Support > Repository > Workflow > Control flow according to conditions
ja | en

Depending on the condition, you can specify which flow will be processed next. R7.2

I will explain here by taking "purchasing goods purchase" as an example.We use the model definition in Figure 1.

Figure 1 Item purchase inquiry model

rule

Apply the following rule.According to the amount "the next approver will be skipped".

Amount of moneyManager approvalDirector approvalApproved by the managerPresident approval (approval)
Less than 500,000 yen---
500,000 yen or more and less than 1 million yen--
1 million yen or more and less than 10 million yen-
10 million yen or more

account

We will prepare the following five accounts.

accountName
user1Applicant
user2Manager
user3Manager
user4Director
user5The president

Flow pattern

We prepare "sequential, sequential, sequential, sequential, sequential flow". In the explanation, it is described as "application → section manager approval → manager approval → head general approval → decision".We assume that the final "approval" doubles as "president approval".

Figure 2 Addition of flow pattern

Flow Participant

Assign user1 to user5 as shown in Figure 3.

Figure 3 Add flow participants

Specify conditions in flow setting

If you select "Sales partial item purchase inquiry flow" prepared in Figure 3, it will be the initial route as shown in Figure 4.

Figure 4 Flow setting in the initial state

Prepare a "condition setting" column here.After the section manager approves, we will add the conditions for immediate decision by amount.The description rule of the condition part is as follows.

  • In the condition description "starting point" and "end point" are mandatory.It becomes the hierarchical ID of the node.In the figure, the "1" portion of the node described as "1. Sequential" is the hierarchical ID.
  • If you specify a hierarchical ID that does not exist for "end point", it automatically goes to "decision" (circle on the right in the figure).For example, "999" should be used.
  • The condition part describes the server side JavaScript code.Please return true or false in the return statement.When this condition is satisfied (true is returned), it moves to the hierarchical ID of the end point.
  • If the condition is empty, be sure to move to the hierarchical ID of the end point.
  • If you add more than one condition, the standard route will be deleted.(In Figure 5, the standard linear route originally found in Figure 4 has disappeared.)
return kian.price < 500000
Figure 5 Add one condition

Figure 6 shows an example of pressing the "Insert" button and adding a route from the applicant to the section manager approval.Here the condition part is empty.This draws the route from "1" to "2".

Figure 6 Route setting with empty condition part

Figure 7 shows the state of all routes.

Figure 7 Setting All Conditions

Manager's decision

An example of purchase inquiries less than 500,000 yen is shown in Figure 8 and Figure 9.

Figure 8 Purchase in less than 500,000 yen
Figure 9 Starting workflow (application)

Log on as the manager account (user 2) and approve it. At this stage it will be decided and the workflow will end.(FIG. 10, FIG. 11)

Figure 10 Approval action by section manager
Figure 11 Approval by section manager will be approved

Manager's decision

Figure 12 shows an example of purchase inquiries of 500,000 yen or more and less than 1 million yen.

Figure 12 Purchase inquiries of 500,000 yen or more and less than 1 million yen

Immediately after approval by the section manager is shown in Fig.Flow status will be "Manager approved".

Fig. 13 Manager approval

Subsequently, we got approval by the director in Figure 14.It will be settled at this stage.

Figure 14 Approval of manager will be approved

General manager's decision

Figure 15 shows an example of purchase inquiries of 1 million yen or more and less than 10 million yen.

Fig. 15 Purchase inquiries of 1 million yen or more and less than 10 million yen

Figure 16 shows the approval given by the general manager.It will be settled at this stage.

Figure 16 Approval by the head of the department is approved

President's decision

An example of purchasing inquiries of 10 million yen or more is shown in Figure 17.

Fig. 17 Purchase inquiries of 10 million yen or more

Figure 18 shows the approval by the president.

Figure 18 I went to the President's decision

rule

Apply the following rule.In addition to the above example, "First Approver" will change according to the amount.

Amount of moneyManager approvalDirector approvalApproved by the managerPresident approval (approval)
Less than 500,000 yen---
500,000 yen or more and less than 1 million yen---
1 million yen or more and less than 10 million yen---
10 million yen or more---

The setting is as shown in Figure 19.

Figure 19 Setting conditions

Description of condition part

The condition part can be described over multiple lines.So you can write complex conditions.Here is an example.

Var p = kian.price; if (p <500000) {return true;} return false;

The programming grammar is JavaScript.Detail is"Business logicPlease read.

Camel notation applies to item names

As for "Model ID", the name stated in the design information can be used as it is.(In the example above, it is expressed as "kian".)

Camel notation is applied to "Item ID".
For example, if the item ID is "group_cd", it is written as "groupCd" in the script.

return koubai_model.groupCd == 1

About circulation

If the flow is circulated due to incorrect condition description, it will not work properly.Please be careful not to circulate when setting.