# Variables

We divide variables into thee groups:

  1. global variables
  2. scope variables
  3. process variables

All these variables are accessible in [LPL](LPL language) and Lattenizer.

# Application wide variables

  • Prefix: __ (double underscore)

Global variables are stored in application and cannot be changed in the process.

They can be modified in application environment ($_ENV in Docker or in NEON configuration files).

# Application

In application variable you can access the ENV defined variables.

  • Variable: $__app
  • Fields:
    • $__app->params list of app's parameters
    • $__app->params->foo one parameter

Example of ENV variables

NETTE__PROCESSING__FOO => $__app->params->foo.

# User

User entity can be accesed from multiple sources. Current logged user is found under $__user variable. User entities are also accessible from our processing variables.

  • Variable:
    • $__user->id returns current logged user's ID
    • $__user->fullname returns current logged user's name and surname
    • $_process->activeStep->resolver->email return process active step resolver's email
    • $_process->creator->id returns process creator's ID
    • $_process->roles[NAME][N] returns user entity of Nth user in NAME role for process
    • and more...
  • Fields:
    • $__user->id returns user's ID
    • $__user->email returns user's email
    • $__user->fullname returns user's name and surname
    • $__user->username returns user's username
    • $__user->salutation returns user's salutation
    • $__user->nickname returns user's nickname
    • $__user->titlesBeforeName returns user's titles before name
    • $__user->titlesAfterName returns user's titles after name
    • $__user->titlesAfterName returns user's titles after name
    • $__user->birthday returns user's birthday
    • $__user->nameDay returns user's name day
    • $__user->chatUrl returns user's chat url
    • $__user->webUrl returns user's web url
    • $__user->description returns user's description
    • $__user->phones returns user's phones
    • $__user->company returns user's company name
    • $__user->job returns user's job position
    • $__user->department returns user's department
    • $__user->addresses returns user's address entities list
    • $__user->phones returns user's phones entities list
$__user->fullname
$__user->birthday
$_process->activeStep->resolver->fullname
$_process->roles['@creator'][0]->email

$_process->roles['technicians'][0]->email
$_process->roles['technicians'][1]->email
1
2
3
4
5
6
7

# User => Address

  • Variable:
    • $__user->addresses
    • $_process->creator->addresses
  • Fields:
    • $_process->{...}->addressOne returns user's addressOne
    • $_process->{...}->addressTwo returns user's addressTwo
    • $_process->{...}->zipCode returns user's zipCode
    • $_process->{...}->city returns user's city
    • $_process->{...}->poBox returns user's poBox
    • $_process->{...}->label returns user's label
{foreach $_process->creator->addresses as $address}
	{$address->city}
{/foreach}
1
2
3

# Process ⇛ User => Phone

  • Variable:
    • $__user->phones
    • $_process->activeStep->resolver->phones
    • $_process->creator->phones
  • Fields:
    • $_process->{...}->label returns user's phone label
    • $_process->{...}->number returns user's phone number
{foreach $_process->creator->phones as $phone}
	{$phone->label} - {$phone->number}
{/foreach}
1
2
3

# Global variables

Variables defined in administration under global variables tab.

  • Variable: $__globals
  • Fields: defined in administration

# Scope variables

  • Prefix: _ (single underscore)

Scope variables are connected to process instance and comes from processing logic.

Processing variables are strictly read only. They are modified indirectly by processing logic.

# Process

Contains information about current process instance.

  • Variable:
    • $_process
  • Fields:
    • $_process->id returns identification
    • $_process->state returns state (1=pending, 2=active, 10=complete)
    • $_process->creator returns User
    • $_process->templateProcess returns ProcessTemplate
    • $_process->activeStep returns current ProcessStep
    • $_process->steps returns array of ProcessStep
    • $_process->variables returns ProcessVariable[]
    • $_process->roles returns array indexed by role name of Users in each role
    • $_process->tags returns array indexed by tag key of ProcessTags
    • $_process->createdAt returns process creation date and time (Datetime object returned)
    • $_process->updatedAt returns date and time of last process update (Datetime object returned)
    • $_process->endedAt returns date and time of process end (Datetime object returned)
    • $_process->timer returns ProcessTimer
    • $_process->discussion returns array of ProcessDiscussion
{* List user emails from technician role *}
{foreach $_process->roles['technician'] as $user}
	{$user->email}
{/foreach}

{* We know @creator role has always one user so we can access it like this *}
{$_process->roles['@creator'][0]->email}
1
2
3
4
5
6
7

# Process ⇛ TemplateProcess

  • Variable:
    • $_process->templateProcess
  • Fields:
    • $_process->templateProcess->name return template name
    • $_process->templateProcess->version return version

# Process ⇛ TemplateStep

  • Variable:
    • $_process->activeStep->templateStep
    • $_process->steps[NAME]->templateStep
  • Fields:
    • $_process->{...}->name returns step's name
{foreach $_process->steps as $step}
	{$step->templateStep->name}
{/foreach}
1
2
3

# Process ⇛ ProcessStep

  • Variable:
    • $_process->activeStep
    • $_process->steps[NAME]
  • Fields:
    • $_process->{...}->templateStep returns TemplateStep for this step
    • $_process->{...}->resolver returns step's resolver User or null
    • $_process->{...}->expiration return timestamp or null
    • $_process->{...}->plannedTo return timestamp or null
    • $_process->{...}->plannedFrom return timestamp or null
    • $_process->{...}->readers return array of User objects

# Process ⇛ ProcessStep ⇛ ProcessStepAsync

  • Variable:
    • $_process->activeStep->async
    • $_process->steps[NAME]->async
  • Fields:
    • $_process->{...}->startedAt returns timestamp or null when async step is triggered
$_process->activeStep->async->startedAt
$_process->steps['repair']->async->startedAt
1
2

# Process ⇛ ProcessStep ⇛ ProcessStepTimer

  • Variable:
    • $_process->activeStep->timers[NAME]
    • $_process->steps[NAME]->timers[NAME]
    • $_process->steps[NAME]->timers->all
  • Fields:
    • $_process->{...}->duration returns duration in seconds
    • $_process->{...}->running returns true/false

Variable all also contains duration and running fields:

  • running returns number of running timers
  • duration returns sum of all timers durations
$_process->activeStep->timers['Antenna fix']->running
$_process->steps['repair']->timers['Antenna fix']->duration

$_process->steps['repair']->timers->all->running // Number of running timers
$_process->activeStep->timers->all->duration // Sum of durations
1
2
3
4
5

# Process ⇛ ProcessTimer

  • Variable:
    • $_process->timer
  • Fields:
    • $_process->timer->duration returns sum of duration of all timers in process in seconds
    • $_process->timer->running returns number of running timers in process

# Process ⇛ ProcessTag

  • Variable:
    • $_process->tags[NAME]
  • Fields:
    • $_process->{...}->id
    • $_process->{...}->title
    • $_process->{...}->description
    • $_process->{...}->color

# Process ⇛ ProcessDiscussion

  • Variable:
    • $_process->discussion->first returns earliest ProcessDiscussion or null
    • $_process->discussion->last returns latest ProcessDiscussion or null
    • $_process->discussion returns array of ProcessDiscussion
  • Fields:
    • $_process->discussion->last->id
    • $_process->discussion->last->message
    • $_process->discussion->last->author returns **User**
    • $_process->discussion->last->parent parent discussion ID or null
    • $_process->discussion->last->type normal or system

# Process ⇛ ProcessVariable

  • Variable:
    • $_process->variables[NAME]
  • Fields:
    • Scalar:
      • $_process->variables[invoiceNum]
    • JSON:
      • $_process->variables[customer]->name
      • $_process->variables[customer]->surname

# Process variables

  • Prefix: none

Process variables are defined and used within process templates and creates process logic.

You can find more in ProcessTemplate under section about Variables.

We divide variables into 2 types scalar and json.

# Scalar variables

variables:
	invoiceNum:
		title: Invoice number
		type: scalar
	customerName:
		title: Customer name
		type: scalar
	customerSurname:
		title: Customer surname
		type: scalar
1
2
3
4
5
6
7
8
9
10
This is invoice num: {$invoiceNum}
My name is {$customerName} {$customerSurname}
1
2

# JSON variables

variables:
	invoice:
		title: Invoice object
		type: json
	customer:
		title: Customer object
		type: json
1
2
3
4
5
6
7
This is invoice num: {$invoice->num}
My name is {$customer->name} {$customer->surname}
1
2

There are a few custom JSON specifications such as processes or files.

# spec: processes

These variables reference array of processes objects.

  • Variable:
    • $xprocesses references array of processes
  • Fields
    • $xprocesses[0..N] returns Process
    • $xprocesses->all returns structural object
      • $xprocesses->{...}->done returns true/false if all processes are completed or not
      • $xprocesses->{...}->timer returns structural object
        • $xprocesses->{...}->duration returns sum of all processes duration in seconds
        • $xprocesses->{...}->running returns number of running timers in all processes
variables:
	xprocesses:
		title: Reference to all subprocesses
		type: json
		spec: processes
1
2
3
4
5
{foreach $xprocesses as $sub}
	{$sub->templateProcess->name}
{/foreach}

{if $xprocesses->all->timer->running > 0}
	Timers are running with {$xprocesses->all->timer->duration}s and counting
{/if}

{if $xprocesses->all->done}
	All subprocesses are complete.
{else}
	There are still some subprocess running.
{/if}
1
2
3
4
5
6
7
8
9
10
11
12
13

Learn more about how to start subprocess at callback process_starter.

# LPL vs Lattenizer

The main difference is in syntax.

Lattenizer

{$__app->params->sample}
{$__user->id}
{$_process->templateProcess->name}
{$invoiceId}
1
2
3
4

LPL

__app.params.sample
__user.id
_process.templateProcess.name
invoiceId
1
2
3
4