LetsFlow
  • Introduction
  • Tutorial
    • The basics
    • A handshake
    • A conversation
    • A proper introduction
    • Group meeting
    • Quote
  • Cookbook
  • ENGINE
    • Installation
    • Authentication
    • API
    • Services
      • Configuration
      • Messaging
        • ZeroMQ
        • AMQP 0-9-1
        • Webhook
      • Engine service
  • Integration
    • Frontend
      • React
      • Angular
      • Vue
      • Svelte
    • Backend
  • Reference
    • Scenario
      • Actor
      • Action
        • Update instruction
      • State
        • Transition
          • Log
        • Notify
      • Data function
    • Schema
    • Process
      • Current state
      • Previous log
      • Prediction
      • Events
        • Instantiate event
        • Action event
        • Timeout event
  • Libraries
    • Core library
    • JMESPath
    • Test suite
      • Given
      • When
      • Then
        • Assert state
        • Assert actor
        • Assert variable
        • Assert service
        • Assert event
      • Customize
  • Advanced topics
    • Deep integration
    • Decentralized workflows
    • Custom JMESPath functions
    • Custom YAML tags
Powered by GitBook
On this page
  • Simplified
  • Properties
  • set
  • value
  • stub
  • mode
  • if

Was this helpful?

  1. Reference
  2. Scenario
  3. Action

Update instruction

Update instructions are used to update the process information after executing an action. The process title, tags actors, variables, and the result can be modified at runtime.

You may set current.actor to target the actor that performed the action.

actions:
  set_feeling:
    response: string
    update: current.actor.feeling
  generate_name_tag:
    response:
      id: string
      body: string
    update:
      set: vars.document
      mode: replace
      if: !ref current.actor.needs_name_tag
      value:
        url: !tpl https://docs.example.com/name-tags/{{ current.response.id }}
        content: !ref current.response.body
        media_type: text/html
      stub:
        url: https://docs/example.com/name-tags/dummy
        content: Dummy content
        media_type: text/html
{
  "actions": {
    "set_feeling": {
      "response": "string",
      "update": "current.actor.feeling"
    },
    "generate_name_tag": {
      "response": {
        "id": "string",
        "body": "string"
      },
      "update": {
        "set": "vars.document",
        "mode": "replace",
        "if": {
          "<ref>": "current.actor.needs_name_tag"
        },
        "value": {
          "url": {
            "<tpl>": "https://docs.example.com/name-tags/{{ current.response.id }}"
          },
          "content": {
            "<ref>": "current.response.body"
          },
          "media_type": "text/html"
        },
        "stub": {
          "url": "https://docs/example.com/name-tags/dummy",
          "content": "Dummy content",
          "media_type": "text/html"
        }
      }
    }
  }
}

Simplified

A simple update instruction can be set with a single string. This will be normalized to be the set property. The value will default the current.response.

Properties

set

string (required)

A reference to the target item in the process that should be updated.

Note that reference must be a simple dot notation for object and array access (eg assets.stock.items[3]). It can't be a full JMESPath expression.

value

The value to which the target should be set. By default, this is the value of the response (current.response).

stub

During prediction, the default response, determined by the action response schema, is used for the update instructions. Alternatively, you may set a stub to force a value to be used when predicting the next states.

mode

'replace' (default), 'merge', or 'append'

  • replace - Replace the target with the value

  • merge - If both the target and value are objects or if both are arrays, merge them. If the types do not match, default back to replace.

  • append - Append the value to the target. The target is expected to be an array. If it's not, it's first set to an empty array before appending the value.

if

This field must be true for the action to be allowed to be executed. Typically used in combination with a <ref> data function.

PreviousActionNextState

Last updated 2 months ago

Was this helpful?

any or

The value is typically set using a .

any or

boolean or

function
data function
function
function