# Variables
We divide variables into three groups:
- global variables
- scope variables
- process variables
All these variables can be used in 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
The variable __app
can be used to access application state and environment ENV
variables. Environment variables are defined in application configuration by a system administrator.
- Variable:
$__app
- Fields:
$__app->params
list all ENV variables$__app->params->foo
returns foo ENV variable$__app->locale
returns current locale (cs
oren
)
Example of ENV variables
NETTE__PROCESSING__FOO_BAR=44
is accessed as $__app->params->foo_bar
with value 44
.
# Global variables
Variables defined in administration under global variables tab.
- Variable:
$__globals
- Fields: defined in administration
# 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
- Fields:
$__user->id
returns user's ID$__user->email
returns user's email$__user->name
returns user's name$__user->surname
returns user's surname$__user->fullname
returns user's surname and name$__user->fullnameReverse
returns user's name and surname$__user->username
returns user's username$__user->role
returns user's role$__user->state
returns user's state$__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->signature
returns user's signature$__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->allowedContacts
returnstrue
if user can edit contacts$__user->metadata
returnsarray
with defined metadata$__user->color
returnsstring
with color hex code f.e.#f7fafc
- Functions:
$__user->isInGroup('admins')
returns true/false if user is in selected group
$__user->fullname
$__user->birthday
$_process->activeStep->resolver->fullname
$_process->roles['@creator'][0]->email
$_process->roles['technicians'][0]->email
$_process->roles['technicians'][1]->email
2
3
4
5
6
7
# UserAddress
- 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}
2
3
# UserPhone
- 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}
2
3
# 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->history
returns collection of ProcessStepHistory ordered from the oldest to most recent$_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->modifiedAt
returns date and time of process last modified (Datetime
object returned)$_process->timer
returns ProcessTimer$_process->discussion
returns collection of ProcessDiscussion
- Functions:
$_process->isCreator($__user)
return true/false if selected user is proces creator$_process->isSupervisor($__user->id)
return true/false if selected user is supervisor$_process->isInRole($__user, 'admins')
return true/false if selected user is in selected role$_process->getParent($collection = 'default')
return ProcessProxy or null$_process->getChildren($collection = 'default')
return array of ProcessProxy
{* 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}
2
3
4
5
6
7
# TemplateProcess
- Variable:
$_process->templateProcess
- Fields:
$_process->templateProcess->name
return template name$_process->templateProcess->version
return version
# TemplateStep
- Variable:
$_process->activeStep->templateStep
$_process->steps[NAME]->templateStep
- Fields:
$_process->{...}->title
return step's name$_process->{...}->sid
return step's sid
{foreach $_process->steps as $step}
{$step->templateStep->name}
{/foreach}
2
3
# ProcessStep
- Variable:
$_process->activeStep
$_process->steps[NAME]
- Fields:
$_process->{...}->id
returns process step id$_process->{...}->state
returns process step state (pending
,active
,complete
)$_process->{...}->data
returns process step data as string$_process->{...}->templateStep
returns TemplateStep for this step$_process->{...}->resolver
returns step's resolver User ornull
$_process->{...}->expiration
return timestamp ornull
$_process->{...}->plannedFrom
return planned from (inclusive) timestamp ornull
$_process->{...}->plannedTo
return planned to (exclusive) timestamp ornull
Note: This value is exclusive. For example, if you have an all-day plan that has anto
of 2018-09-03, then plan will last through 2018-09-02 whole day and end before the start of 2018-09-03.$_process->{...}->plannedAllDay
returnboolean
$_process->{...}->planning
returnProcessStepPlanning
$_process->{...}->startedAt
return timestamp ornull
$_process->{...}->endedAt
return timestamp ornull
$_process->{...}->readers
return array of User objects$_process->{...}->possibleResolvers
return array of User objects
- Functions:
$_process->{...}->hasResolver()
return true/false if step has resolver$_process->{...}->isResolver($__user)
return true/false if selected user is this step resolver$_process->{...}->isReader($__user->id)
return true/false if selected user is this step reader$_process->{...}->isPossibleResolver($__user->id)
return true/false if selected user is in this step's resolver role
# 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
2
# ProcessStepPlanning
- Variable:
$_process->activeStep->planning
- Fields:
$_process->{...}->planning->from
returnsDatetime
object inEurope/Prague
timezone ornull
$_process->{...}->planning->to
returnsDatetime
object inEurope/Prague
timezone ornull
$_process->{...}->planning->from('Europe/London')
returnsDatetime
object in desired timezone ornull
$_process->{...}->planning->to('Europe/London')
returns datetimeDatetime
object in desired timezone ornull
Datetime step.plannedTo
is exclusive. However, planning object modifies to
to return inclusive value (-1 day in case allDay is true), so it is prepared to be displayed to the user.
$_process->activeStep->from->format($_process->activeStep->plannedAllDay ? 'd. m. Y' : 'd. m. Y H:i')
# ProcessStepHistory
- Variable:
$_process->history->first
returns first closed step reference ProcessStepHistory$_process->history->last
returns previous closed step reference ProcessStepHistory$_process->history[5]
- Fields:
$_process->history->last->step
returns ProcessStep$_process->history->last->endedAt
returnsDatetime
$_process->history->last->resolver
returns User
# ProcessTimer
- 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$_process->{...}->entries
returns array of ProcessTimerEntry
$_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
2
3
4
5
# ProcessTimer summary in process
- 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->timer->entries
returns array of ProcessTimerEntry
# ProcessTimerEntry
- Variable:
$_process->timer->entries
$_process->steps[NAME]->timers[NAME]->entries
$_process->activeStep->timers->all->entries
- Fields:
name
returns entry note or timer title if emptystart
returns start datetime (Datetime
object returned)end
returns end datetime (Datetime
object returned) or null if runningduration
returns duration in secondstimer
returns timer titlerunning
returns true/falseresolver
returns User
# ProcessTag
- Variable:
$_process->tags[NAME]
- Fields:
$_process->{...}->id
$_process->{...}->title
$_process->{...}->description
$_process->{...}->color
# ProcessDiscussion
- Variable:
$_process->discussion->first
returns earliest ProcessDiscussion or null$_process->discussion->last
returns latest ProcessDiscussion or null$_process->discussion
returns collection 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
# ProcessFile
- Variable:
$_process->files
- Fields:
$_process->{...}->id
$_process->{...}->name
$_process->{...}->size
returns size in bytes. Use latte macro |bytes to convert to human readable$_process->{...}->mimeType
returns MIME type$_process->{...}->uploader
returns User$_process->{...}->uploadedAt
returns DateTime$_process->{...}->uploadedVia
returns service used to upload file$_process->{...}->description
returns file description
A link to a file can be generated in lattenizer.
# ProcessVariable
- Variable:
$_process->variables[NAME]
- Fields:
- Scalar:
$_process->variables[invoiceNum]
- JSON:
$_process->variables[customer]->name
$_process->variables[customer]->surname
- Scalar:
# Contacts
- Variable:
$_process->contacts->{...}
`returns all contacts from a contact collection
- Fields:
$_process->contacts->{...}[0]->id
$_process->contacts->{...}[0]->assembledName
returns complete name in format Ing. Joe Doe, Ph.D. (Company a.s.)$_process->contacts->{...}[0]->fullname
$_process->contacts->{...}[0]->name
$_process->contacts->{...}[0]->surname
$_process->contacts->{...}[0]->salutation
$_process->contacts->{...}[0]->nickname
$_process->contacts->{...}[0]->titlesBeforeName
$_process->contacts->{...}[0]->titlesAfterName
$_process->contacts->{...}[0]->birthday
returns DateTime$_process->contacts->{...}[0]->nameDay
$_process->contacts->{...}[0]->chatUrl
$_process->contacts->{...}[0]->webUrl
$_process->contacts->{...}[0]->company
$_process->contacts->{...}[0]->in
$_process->contacts->{...}[0]->tin
$_process->contacts->{...}[0]->incorporation
$_process->contacts->{...}[0]->job
$_process->contacts->{...}[0]->department
$_process->contacts->{...}[0]->category
returns Contact Category$_process->contacts->{...}[0]->addresses
returns array of Contact Addresses$_process->contacts->{...}[0]->phones
returns array of Contact Phones$_process->contacts->{...}[0]->emails
returns array of Contact Emails$_process->contacts->{...}[0]->tags
returns array of Contact Tags
# ContactCategory
- Variable:
$_process->contacts->{...}[0]->category
- Fields:
$_process->contacts->{...}[0]->category->title
$_process->contacts->{...}[0]->category->key
# ContactAddresses
- Variable:
$_process->contacts->{...}[0]->addresses
- Fields:
$_process->contacts->{...}[0]->addresses[0]->assembledAddress
returns formatted complete address$_process->contacts->{...}[0]->addresses[0]->street
$_process->contacts->{...}[0]->addresses[0]->houseNumber
$_process->contacts->{...}[0]->addresses[0]->zipCode
$_process->contacts->{...}[0]->addresses[0]->city
$_process->contacts->{...}[0]->addresses[0]->poBox
$_process->contacts->{...}[0]->addresses[0]->note
$_process->contacts->{...}[0]->addresses[0]->type
# ContactEmails
- Variable:
$_process->contacts->{...}[0]->emails
- Fields:
$_process->contacts->{...}[0]->emails[0]->email
$_process->contacts->{...}[0]->emails[0]->type
$_process->contacts->{...}[0]->emails[0]->note
# ContactTags
- Variable:
$_process->contacts->{...}[0]->tags
- Fields:
$_process->contacts->{...}[0]->tags[0]->title
$_process->contacts->{...}[0]->tags[0]->key
$_process->contacts->{...}[0]->tags[0]->color
# ContactPhones
- Variable:
$_process->contacts->{...}[0]->phones
- Fields:
$_process->contacts->{...}[0]->phones[0]->number
$_process->contacts->{...}[0]->phones[0]->type
$_process->contacts->{...}[0]->phones[0]->note
# 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
2
3
4
5
6
7
8
9
10
This is invoice num: {$invoiceNum}
My name is {$customerName} {$customerSurname}
2
# JSON variables
variables:
invoice:
title: Invoice object
type: json
customer:
title: Customer object
type: json
2
3
4
5
6
7
This is invoice num: {$invoice->num}
My name is {$customer->name} {$customer->surname}
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
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}
2
3
4
5
6
7
8
9
10
11
12
13
Learn more about how to start subprocess at callback process_starter
.