Documentation / Conception / Guides pratiques / Prepare and approve a result

Prepare and approve a result

Load @posos/common 0.4.2 or later on a host supporting plugin contract 0.1.5. This recipe prepares a total from a list and asks someone to approve it. The plugin's catalogue contains the full operation descriptions.

  1. Add Liste, choose element type Integer, operation Filtrer, and expression item > 1. Supply [1, 3, 2] to items.
  2. Add another Liste, choose Integer, Agréger, Somme and expression item. Connect the first node's items to the second node's items.
  3. Add Calcul, declare an input total of type Decimal, result type String, and expression "Total: " + inputs.total. Connect the aggregate's value to total. The result is Total: 5.
  4. Add Date et durée, operation Instant courant. Add Validation humaine, type String, title Relire le total, message Date : {at} and deadline 60. Connect the calculation's value to the approval's value, and the date node's value to the message's at template input.
  5. Connect accepted, rejected and timedOut to separate next steps. Only one is present. accepted and rejected carry the submitted text; decision also carries the author, timestamp and optional comment.
  6. Use Tester l’exemple in the calculation/list workshop to inspect outputs, then simulate acceptance, rejection and expiration before publishing.

Use the existing JEXL syntax, including transforms such as (inputs.amount * 1.2)|round(2) for a Decimal calculation. Declare every input; a missing optional result emits missing, while a wrong result type fails. To transform every item, put the calculation inside the existing flow.map.

An empty list is valid. An empty sum is zero and emits empty; empty mean/min/max emit empty without value, so wire that branch explicitly if it matters. List operations accept at most 10,000 items. Date arithmetic uses fixed durations and explicit timezones; one day is 24 hours, including across daylight saving. A run's current instant is recorded once and reused on replay.

The approval's optional recipient is displayed in the request. It does not send a notification or restrict who may decide. Configure those responsibilities through your instance's existing adapters and access policy. Omit the deadline to wait indefinitely.

97 documents0 sectionssource : /docs · généré au build