Skip to content

Transitions

In invoiceR, a document passes through a series of process steps (nodes) connected by routes. A transition is program logic that is applied to the document when it moves along a specific route. A route can have several transitions, and the same transition can be used on several routes.

Transitions are registered in the conf.Transitions table:

ColumnContent
Idnew GUID
TenantIdusually 1
ClassIdentifierfull class name of the transition
Descriptionshort description
RouteIdId of the route from conf.Routes on which the transition should run
Orderorder when a route has several transitions (ascending)
INSERT INTO conf.Transitions (Id, TenantId, ClassIdentifier, Description, RouteId, [Order])
VALUES (NEWID(), 1,
N'enio.InvoiceR.Engine.DefaultPlugin.Transitions.FourEyeForcerTransition',
N'Enforce four-eyes principle',
N'<Id of the route from accounting to approval>', 1);

Enforcing the four-eyes principle (FourEyeForcerTransition)

Section titled “Enforcing the four-eyes principle (FourEyeForcerTransition)”

Class: enio.InvoiceR.Engine.DefaultPlugin.Transitions.FourEyeForcerTransition

This transition typically runs after accounting and before approval. For each accounting line, it checks whether at least a certain number of different users or roles have to approve. If not, it creates an additional approval request for the line. The effect is the same as if someone had requested a manual approval during accounting.

The transition reads these settings (section WorkflowManagement:FourEyeForcer in appsettings.json or per tenant in the database, see Overview):

SettingMeaning
MinimumOfUsersForVisaRequestminimum number of approvers per line, usually 2. Existing approval requests count. Required.
DefaultUserForEnforcing4EyePrincipleId of the user who receives the additional approval
DefaultRoleFourEnforcing4EyePrincipleId of the role that receives the additional approval
Prioritypriority of the new approval request. This controls whether it is obtained before, together with or after the approvals from the rules.
CostcenterForCheckingThe4EyePrincipleoptional: number of a cost center. The transition then only checks lines with this cost center. Empty means all lines.

Enter at least one user or role.

{
"WorkflowManagement": {
"FourEyeForcer": {
"MinimumOfUsersForVisaRequest": "2",
"DefaultRoleFourEnforcing4EyePrinciple": "12",
"Priority": "10"
}
}
}

These transitions run after accounting is complete and automatically give the accountant an approval. There are two variants:

  • SimpleAccountantVisumTransition: only gives the approval if the accountant would have to approve according to the approval rules anyway. If the accountant does not appear in the rules, nothing changes.
  • AccountantVisumTransition: creates an approval request for the accountant on every accounting line and grants it immediately (unless a request for them already exists).

Both classes are in the namespace enio.InvoiceR.Engine.DefaultPlugin.Transitions. The automatically granted approval appears in the document history.

INSERT INTO conf.Transitions (Id, TenantId, ClassIdentifier, Description, RouteId, [Order])
VALUES (NEWID(), 1,
N'enio.InvoiceR.Engine.DefaultPlugin.Transitions.SimpleAccountantVisumTransition',
N'Automatic approval for accountant',
N'<Id of the route after accounting>', 1);