eADM rule expression engine

eADM rule expression engine

Overview

The rule expression engine evaluates bracket functions and field placeholders in eADM. Expressions appear in:

Consumer

Typical use

Rulesets (Regelsett)

Filter users, departments, groups; gate message flows, sync steps, permissions

Message templates

Dynamic recipient, subject, body (HTML)

Export templates / sync template flow lines

Target attribute mapping

Customer setup

Username expression, auto-group naming, position filter

Form templates

Form field bindings

Expression builder

Preview against a test user, department, or group

How evaluation works

  1. The engine scans the expression for [...] tokens.

  2. [ARRAYFOREACH...] runs first — before the innermost-first pass — so template placeholders ??? and ???i bind per pipe-separated element.

  3. Otherwise it resolves the innermost bracket pair first.

  4. Each function returns a plain text result that replaces the bracket.

  5. When no functions remain, remaining [FieldName] tokens are replaced from the current object (and optional history row in message flows).

  6. Unrecognised field names stay as literal [FieldName] in the output.

Pipe-separated lists (|) are used for multi-value data — especially HR positions on a user.

Dummy data used in examples below

Unless stated otherwise, examples assume customer Eksempel kommune with:

Object

Key values

User Kari Nordmann

GivenName=Kari, Surname=Nordmann, DisplayName=Kari Nordmann, UserName=kari.nordmann, Email=kari.nordmann@eksempel.kommune.no, Start=01.04.2026 00:00:00, Department=IT og digitalisering, DepartmentNumber=100

User positions (pipe-aligned)

APositionCodeId=POS-01\|POS-02, AUnitId=IT-100\|HR-200, APositionCodeName=Utvikler\|HR-rådgiver, APrimaryPosition=true\|false, APositionPercentage=100.0\|20.0

Department IT (type 2)

Id=2100, SourceId=IT-100, DepartmentNumber=100, OrgUnitnr=IT-100, ParentDepartmentNumber=0

Department HR (child of IT)

Id=2101, SourceId=HR-200, ParentDepartmentNumber=100

System role (permission)

Id=501, Name=Bruker Fagsystem X, linked to system id=12

Permission on Kari

SystemRoleId=501, ManagerOf=2100, Comment=Automatisk tildelt, ExpiryDate=empty

Object type ids (for lookups): User=1, Department=2, Group=3, API user=14.


Syntax conventions

  • Functions: [NAME;arg1;arg2;...] — arguments separated by semicolon (;).

  • Fields: [FieldName] — value from current object (case-insensitive).

  • Nested expressions: inner brackets resolved before outer.

  • Dates in fields are often stored as dd.MM.yyyy HH:mm:ss; imports may use yyyy-MM-dd and other common formats.

Query mini-language

Used inside [FOREACH], [IFTHENELSE], and advanced [OBJECT...] filters.

Token

Meaning

=

Equal

>, <

Greater / less than

!

Not equal

*

Pattern match (like)

#

Value in list

&

AND next condition

\|

OR next condition

Prefix related data with object., system., systemrole., objectpermission., etc.


Nesting

Inner field first, then outer function

Step

Expression fragment

Resolves to

1

[start]

01.04.2026 00:00:00

2

[SUBSTRING;0;10;01.04.2026 00:00:00]

01.04.2026

Blocked if inner field missing: [SUBSTRING;0;10;[UnknownField]] stays unchanged when UnknownField is not on the object.

Typical permission chain (read inside-out):

[REFERENCE;DisplayName;UserId;1;[REFERENCE;Manager;Id;2;[OBJECTPERMISSION;ManagerOf;SystemRoleId;501]]]
  1. Permission → department id 2100

  2. Department → manager user id

  3. User → manager display name

[ARRAYFOREACH...] is different: it expands a pipe-separated list before inner functions in the template run. Use ??? for the current element and ???i for its 0-based index. Nesting [ARRAYFOREACH...] inside another [ARRAYFOREACH...] is not supported — use [ARRAYJOIN] / [ARRAYPREFIX] or sibling calls instead.


Access levels

Role

What it affects

Super manager

Expression builder preview

Company administrator

Full function list in builder; [APITOKEN...], [SYNCSTEPPARAMETER...] in preview

Organization administrator

Expressions touching protected fields in preview

Super administrator

[UPDATE...], [DECRYPT...], [ENCRYPT...] — omitted from this guide

Automation (sync, messages, exports) evaluates expressions with server privileges. A function that works in production may still be blocked in the expression builder for your role.


Field placeholders

Not functions — replaced from the current object (or history row in event-driven message flows).

Example: Template Hello [GivenName] [Surname] on Kari Nordmann → Hello Kari Nordmann

Placeholder

Typical source

[GivenName], [Surname], [DisplayName]

Person name

[UserName], [Email], [Upn], [Mail]

Account / mail

[Department], [DepartmentNumber]

Primary department

[Start]

Employment start datetime

[Manager]

Manager reference from HR

[APositionCodeId], [AUnitId], [APositionCodeName]

Multi-position (pipe-separated)

History-only (message flows after sync): [OldValue], [NewValue], [EntryType], [AttributeName], [Comment].


Function reference with examples

Each entry lists parameters, a worked example with dummy data, and expected output.


Date and time

[NÅ] / [NOW]

Returns server date and time.

Parameter

Purpose

(none)

Current moment

+N / -N suffix

Add or subtract N days

Expression

Assumed server date

Output

[NÅ]

17.06.2026 14:30:00

17.06.2026 14:30:00

[NOW+7]

17.06.2026

24.06.2026 14:30:00 (same time, +7 days)

Use: Permission start display, relative deadlines in templates.


[DATEFORMAT;date;format]

Reformats a date string.

Parameter

Purpose

date

Input date, or pipe-separated dates

format

Output pattern (e.g. yyyy-MM-dd, dd/MM/yyyy)

Expression

Input (after field resolve)

Output

[DATEFORMAT;01.04.2026 00:00:00;yyyy-MM-dd]

2026-04-01

[DATEFORMAT;01.04.2026 00:00:00\|15.06.2026 00:00:00;yyyy-MM-dd]

two dates

2026-04-01\|2026-06-15

Use: Export formats, ISO dates in API payloads.


[DATEDIFF;date1;date2;unit]

Numeric difference between two dates.

Parameter

Purpose

date1

Later or primary date

date2

Earlier or reference date

unit

d days (default), y years, m months, h hours, mi minutes, s seconds

Expression

Output

Meaning

[DATEDIFF;17.06.2026 00:00:00;01.04.2026 00:00:00;d]

77

77 days between start and today

[DATEDIFF;17.06.2026 00:00:00;01.04.2026 00:00:00;y]

0

Same calendar year in this example

Use: Tenure checks in rulesets, "days until start" in messages.


[DAYOFYEAR;date]

Parameter

Purpose

date

Date to evaluate

Expression

Output

[DAYOFYEAR;01.04.2026 00:00:00]

91

Use: Seasonal rules, fiscal period tricks.


String manipulation

[SUBSTRING;start;length;text]

Parameter

Purpose

start

0-based start index

length

Number of characters to take

text

Source string (often a nested field)

Expression

Resolved text

Output

[SUBSTRING;0;10;01.04.2026 00:00:00]

01.04.2026

[SUBSTRING;0;4;POS-01]

POS-0

Use: Date-only from datetime in welcome mails: [SUBSTRING;0;10;[Start]]01.04.2026.


[SPLIT;text;delimiter;index]

Parameter

Purpose

text

String to split

delimiter

Separator (e.g. \|, ;, space)

index

0-based piece index, or last / last-1

Expression

Output

[SPLIT;Kari\|Nordmann;\|;0]

Kari

[SPLIT;POS-01\|POS-02;\|;last]

POS-02

Use: Salutation from combined name field; pick last position code.


[REPLACE;text;find;replace]

Parameter

Purpose

text

Original string

find

Substring(s) to replace; pipe = multiple; ^x = only at start; x^ = only at end

replace

Replacement text

Expression

Output

[REPLACE;kari.nordmann;.;-]

kari-nordmann

[REPLACE;+4712345678;+47\|;;]

12345678

Use: Normalise phone numbers, swap separators in usernames.


[REPLACELIST;text;fromChars;toChars]

Character-by-character map (both char lists must be same length).

Parameter

Purpose

text

Input

fromChars

Characters to map from

toChars

Characters to map to

Expression

Output

[REPLACELIST;abcåøæ;åøæaoe]

abcaoe

Use: Legacy character set fixes in imports.


[RTRIM;text;chars] / [LTRIM;text;chars]

Parameter

Purpose

text

Input; if it contains \|, each segment is trimmed

chars

Character(s) to strip from end (RTRIM) or start (LTRIM)

Expression

Output

[RTRIM;POS-01\|POS-02\|;]

POS-01\|POS-02 (trailing empty segment removed)

[LTRIM;; Kari; ]

Kari

Use: Clean pipe lists after [ARRAYDIFF].


[RPAD;text;padChar;totalLength] / [LPAD;text;padChar;totalLength]

Parameter

Purpose

text

Value to pad

padChar

Fill character

totalLength

Target width

Expression

Output

[RPAD;42;0;5]

42000

[LPAD;7;0;4]

0007

Use: Fixed-width employee numbers in file exports.


[RIGHT;length;text]

Parameter

Purpose

length

How many characters from the right

text

Source

Expression

Output

[RIGHT;4;12345678]

5678

Use: Last digits of national id in test environments.


[INITIALS;text;startWord;endWord]

Parameter

Purpose

text

Full name or phrase

startWord

Word index to start (0-based)

endWord

Word index to end, or last / last-1

Expression

Output

[INITIALS;Kari Marie Nordmann;0;last]

K M N (letters plus spaces as produced)

[INITIALS;Kari Marie Nordmann;1;1]

M

Use: Short codes in group names or mail aliases.


[PRETTIFY;text]

Title-cases after space or hyphen.

Expression

Output

[PRETTIFY;kari nordmann]

Kari Nordmann

[PRETTIFY;it-og-digitalisering]

It-Og-Digitalisering

Use: Display names in messages when HR sends uppercase.


[LOWER;text] / [UPPER;text]

Expression

Output

[LOWER;Kari.Nordmann@Eksempel.Kommune.NO]

kari.nordmann@eksempel.kommune.no

[UPPER;avdeling-it]

AVDELING-IT

Use: Normalise before [CLEAN] in username rules.


[CLEAN;text] / [STRICTCLEAN;text] / [CNCLEAN;text]

Strip or replace characters unsafe for usernames, strict ids, or AD common names (CN).

Expression

Typical output

Use

[CLEAN;Kari Åse Nordmann!]

kariasenordmann (non-letters removed, lowercased style)

Username / uid

[CNCLEAN;Kari (test) Nordmann]

CN-safe form for AD

Group or user CN

Exact output depends on customer character rules; test in expression builder.


[GETKEYVALUE;key;delimiter;metadata]

Reads key<delimiter>value pairs inside a pipe-separated metadata string.

Parameter

Purpose

key

Key to find

delimiter

Separator between key and value (often = or :)

metadata

Pipe-separated list of key-value tokens

Expression

metadata value

Output

[GETKEYVALUE;cost;=;cost=IT\|site=Oslo]

IT

Use: Custom import metadata on extension attributes.


Logic and control flow

[IFTHENELSE;query;thenValue;elseValue]

Parameter

Purpose

query

Condition on current object (e.g. ObjectTypeId=1)

thenValue

Returned if query matches

elseValue

Returned if not

Context

Expression

Output

User Kari (type 1)

[IFTHENELSE;ObjectTypeId=1;Ansatt;Ikke ansatt]

Ansatt

Department IT (type 2)

same

Ikke ansatt

Use: Single template for mixed object types.


[IFEMPTYUSE;primary;fallback;reversed]

Parameter

Purpose

primary

Value to test

fallback

Used when primary is empty (default)

reversed

Optional true: use fallback when primary is not empty

Expression

Kari's permission expiry

Output

[IFEMPTYUSE;;Permanent tilgang]

empty

Permanent tilgang

[IFEMPTYUSE;15.12.2026;Permanent tilgang]

15.12.2026

15.12.2026

[IFEMPTYUSE;[Manager];;true]

Manager=empty

`` (empty — reversed: fallback only when manager exists)

Use: Default text for missing expiry, manager, or comment.


[EXISTS;value;resultIfNonEmpty]

Parameter

Purpose

value

Tested string

resultIfNonEmpty

Returned only if value is non-empty

Expression

Kari Manager field

Output

[EXISTS;ola.hansen;has-manager]

ola.hansen

has-manager

[EXISTS;;has-manager]

empty

`` (empty)

Use: Gate nested lookups — only run [REFERENCE...] when [Manager] is set.


[TRANSFORM;input;mapping...]

Parameter

Purpose

input

Value to map

key\|value pairs

Match input to output

*\|default

Wildcard if no key matches

Expression

[Sex] = F

Output

[TRANSFORM;F;M\|Mann;F\|Kvinne;*\|Ukjent]

Kvinne

[TRANSFORM;X;M\|Mann;F\|Kvinne;*\|Ukjent]

Ukjent

Use: HR codes → display text in messages.


[CONTAINS;valueList;targetList;ifYes;ifNo]

Parameter

Purpose

valueList

Pipe-separated needles

targetList

Pipe-separated haystack

ifYes / ifNo

Strings returned on match / no match

Expression

Output

[CONTAINS;IT-100\|FIN-300;HR-200\|IT-100\|SALG-400;ja;nei]

ja (IT-100 found in target)

[CONTAINS;FIN-300;HR-200\|IT-100;ja;nei]

nei

Use: Ruleset-style branching inside a template.


Array (pipe-separated) operations

Lists look like A|B|C. Many HR position fields use this shape.

[COUNT;ignored;list]

Parameter

Purpose

ignored

Placeholder (unused)

list

Pipe-separated values

Expression

Output

[COUNT;x;POS-01\|POS-02\|]

2 (empty trailing segments may affect count — test with your data)

Use: "How many positions does this user have?"


[ARRAYAPPEND;list1;list2]

Expression

Output

[ARRAYAPPEND;POS-01\|;POS-02\|POS-03\|]

POS-01\|POS-02\|POS-03\|

Use: Merge role lists from two permission queries.


[ARRAYUNIQUE;list]

Expression

Output

[ARRAYUNIQUE;A\|B\|A\|C\|]

A\|B\|C\|

Use: Deduplicate department ids before export.


[ARRAYFILTER;list;allowed]

Keeps only items that appear in allowed.

Expression

Output

[ARRAYFILTER;POS-01\|POS-02\|POS-99;POS-01\|POS-02\|]

POS-01\|POS-02\|

Use: Whitelist position types for a message.


[ARRAYDIFF;current;previous]

Items in current not in previous.

Context

current

previous

Output

New position added

POS-01\|POS-02\|

POS-01\|

POS-02\|

No change

POS-01\|

POS-01\|

``

Use: Detect new position in message flow (pair with [LASTVALUE;APositionCodeId]). Warning: unreliable if several positions change in one import.


[ARRAYJOIN;list1;list2]

Zips two lists by index.

Expression

Output

[ARRAYJOIN;Utvikler\|HR-rådgiver;100%\|20%]

Utvikler100%\|HR-rådgiver20%

Use: Combine parallel columns for CSV-style export lines.


[ARRAYFOREACH;array;template] / [ARRAYFOREACH;array;separator;template]

Iterates over a pipe-separated list. For each non-empty element, substitutes ??? with the element and ???i with its 0-based index in the template, evaluates nested [...] in the template, then joins results.

Parameter

Purpose

array

Pipe-separated list (often a field like [APositionCodeName])

separator

Optional join string between iterations (default \|)

template

Text or nested expression; ??? = current item, ???i = index

Expression

Kari APositionCodeName

Output

[ARRAYFOREACH;[APositionCodeName];Stilling: ???]

Utvikler\|HR-rådgiver

Stilling: Utvikler\|Stilling: HR-rådgiver

[ARRAYFOREACH;[APositionCodeId];, ;DEPT-???]

POS-01\|POS-02

DEPT-POS-01, DEPT-POS-02

[ARRAYFOREACH;[APositionCodeId];[SUBSTRING;0;4;???]]

POS-01\|POS-02

POS-\|POS-

[ARRAYFOREACH;[APositionCodeName];???i:???]

Utvikler\|HR-rådgiver

0:Utvikler\|1:HR-rådgiver

Empty pipe segments are skipped (same convention as [ARRAYUNIQUE] / [ARRAYPREFIX]).

Not supported: [ARRAYFOREACH...] nested inside another [ARRAYFOREACH...] — expression evaluation fails. Use two sibling calls or [ARRAYJOIN] instead.

Use: Format each position as its own line in a message; prefix each unit id for export.


[ARRAYPREFIX;list;mode;text]

Parameter

Purpose

list

Pipe-separated items

mode

1 = prefix each item with text; other = suffix

text

Prefix or suffix string

Expression

Output

[ARRAYPREFIX;IT-100\|HR-200;1;DEPT-]

DEPT-IT-100\|DEPT-HR-200\|

Use: Namespace external ids.


[ARRAYTRIM;list;delimiter;maxCount]

Expression

Output

[ARRAYTRIM;A\|B\|C\|D;\|;2]

A\|B

Use: Only first N positions in a summary mail.


[PRUNEARRAY;list;regex;reverse]

Parameter

Purpose

list

Pipe-separated items

regex

.NET regular expression

reverse

true = keep non-matching items instead

Expression

Output

[PRUNEARRAY;POS-01\|TEMP-99\|POS-02;^TEMP;false]

POS-01\|POS-02

[PRUNEARRAY;POS-01\|TEMP-99;^TEMP;true]

TEMP-99

Use: Drop temporary position codes from export.


[UNION;headers;list1;list2;...]

Merges parallel lists row-wise into spaced/pipe combined rows.

Expression

Conceptual output

[UNION;Role\|Dept;Admin\|User;IT\|HR]

Role Admin Dept IT\|User HR (pattern: concatenate columns per index)

Use: Multi-column text blocks in reports.


Random, hash, uniqueness

[RND;min;max]

Parameter

Purpose

min

Minimum integer (inclusive)

max

Maximum integer (exclusive in practice — test your range)

Expression

Example output

[RND;1000;9999]

4521 (varies each run)

Use: Ticket numbers in test templates.


[STRRND;minLen;maxLen;chars]

Parameter

Purpose

minLen / maxLen

Length range

chars

Allowed character set (empty = alphanumeric default)

Expression

Example output

[STRRND;8;8;abcdefghjkmnpqrstuvwxyz]

kthqwrnb (varies)

Use: One-time codes when password rule is not used.


[PASSWORD;ruleId]

Parameter

Purpose

ruleId

Id of password generation rule configured in eADM

Expression

Output

[PASSWORD;3]

e.g. Xk9#mP2$vL (follows rule 3 complexity; varies)

Use: Initial password in welcome message — handle securely.


[HASH;text]

Expression

Output (example)

[HASH;kari.nordmann@eksempel.kommune.no]

32-character MD5 hex string (fixed for same input)

Use: Opaque tokens in links (not for security-critical hashing alone).


[UNIQUE;base;fieldName;replacement]

Ensures base does not already exist in fieldName on another object; appends 2, 3, … or inserts before replacement.

Parameter

Purpose

base

Proposed username or email

fieldName

Field to check uniqueness against (e.g. UserName)

replacement

Optional suffix marker to replace with number

Scenario

Expression

Output

kari.nordmann free

[UNIQUE;kari.nordmann;UserName;.]

kari.nordmann

kari.nordmann taken

same

kari.nordmann2 or kari2.nordmann depending on replacement

Use: Customer setup username expression together with [CLEAN] / [LOWER].


Database lookup and relations

These read live eADM data for the customer. Ids must exist in your environment.

[REFERENCE;returnField;whereField;objectTypeId;searchValue;exactMatch]

Parameter

Purpose

returnField

Field(s) to return from matched object (§ joins multiple fields)

whereField

Field to match on

objectTypeId

1 user, 2 department, 3 group

searchValue

Value to find

exactMatch

true exact; false pattern

Expression

Dummy match

Output

[REFERENCE;OrgUnitnr;Id;2;2100]

Dept id 2100 = IT

IT-100

[REFERENCE;DisplayName;UserId;1;ola.hansen]

Manager user

Ola Hansen

Use: Department number from permission ManagerOf id:

[REFERENCE;OrgUnitnr;Id;2;2100]

[OBJECTPERMISSION;returnField;whereField;filterValue;exactMatch;aggregate]

Reads permissions on the current user.

Parameter

Purpose

returnField

Permission field (Comment, ManagerOf, ExpiryDate, SystemRoleId, …)

whereField

Field to filter on

filterValue

Match value, or * for all

exactMatch

String match mode

aggregate

true = all matches joined with \|; false = first only

Expression

Output (Kari)

[OBJECTPERMISSION;Comment;SystemRoleId;501;true;false]

Automatisk tildelt

[OBJECTPERMISSION;ManagerOf;SystemRoleId;501;true;false]

2100

Shorthand for role name:

Expression

Output

[OBJECTPERMISSION.SYSTEMROLE;Name;SystemRoleId;501]

Bruker Fagsystem X


[OBJECTHISTORIES;returnField;whereField;filterValue;exactMatch;aggregate]

Reads object history on current user (audit trail from sync/UI).

Example filter

Expression

Typical output

Last permission add

[OBJECTHISTORIES;Comment;EntryType;AddPermission;false;false]

Tildelt av admin

Use: "Who assigned this permission?" in message flows (often nested in [SPLIT] / [REFERENCE]).


[FOREACH;collection;query;returnFields;headers;format]

Parameter

Purpose

collection

object, objectpermission, objecthistory, …

query

Filter (company scope added automatically)

returnFields

Comma-separated fields, optionally object.Field

headers

Column titles for csv/html

format

csv, html, json, xml, eadm

Example (conceptual): All users with role 501, CSV:

[FOREACH;objectpermission;SystemRoleId=501;object.DisplayName,object.Email;Name,Email;csv]

Output (dummy):

Name,Email
Kari Nordmann,kari.nordmann@eksempel.kommune.no
Ola Hansen,ola.hansen@eksempel.kommune.no

Use: Manager report embedded in email body.


[DESCENDANTS;rootId;returnField;parentKey;foreignKey]

Parameter

Purpose

rootId

Department object id to start from

returnField

Field to collect from each node

parentKey

Child field pointing to parent (e.g. DepartmentNumber)

foreignKey

Parent identifier field (e.g. ParentDepartmentNumber)

Start

Tree

Expression

Output

IT id 2100

IT → HR

[DESCENDANTS;2100;SourceId;DepartmentNumber;ParentDepartmentNumber]

IT-100,HR-200

Use: All sub-departments for scope on a manager permission.


[SYSTEM;type;id;field]

Parameter

Purpose

type

system, systemrole, or systemroles

id

Numeric id or *

field

Field name(s) to return

Expression

Output (dummy)

[SYSTEM;systemrole;501;Name]

Bruker Fagsystem X

[SYSTEM;system;12;Name]

Fagsystem X

Use: System owner contact in admin notification.


[SELECTION;rulesetId;returnField]

Parameter

Purpose

rulesetId

Ruleset to evaluate per object

returnField

Field from each object that matches

Expression

Output (dummy)

[SELECTION;1001;Email]

kari.nordmann@eksempel.kommune.no\|ola.hansen@eksempel.kommune.no\|

Use: Mailing list of everyone matching "New starters" ruleset.


[AVAILABLESYSTEM;field] / [AVAILABLEROLE;systemId;field]

Returns pipe-separated values for systems or roles that pass their Available for ruleset on the current user.

Expression

Meaning

[AVAILABLESYSTEM;Name]

Names of systems Kari may receive permissions for

[AVAILABLEROLE;12;Name]

Role names on system 12 she may be assigned

Use: Dynamic pick lists in forms or messages.


[AVAILABLEDEPARTMENTS;fields;targetUserId]

Parameter

Purpose

fields

Comma-separated department fields

targetUserId

User to evaluate; empty = current object

Use: List departments a manager may administer (from ManagerOf, unit ids, mega.eadm.no roles).


[DATAOWNER;returnField]

Follows data-owner relation on object; returns field from owner.

Expression

Output (if owner group name stored)

[DATAOWNER;Name]

IT dataeiere


[ANTECEDANTS.SYSTEMROLE;roleId;departmentId;returnField]

Managers holding roleId on ancestor departments of departmentId.

Expression

Output (dummy)

[ANTECEDANTS.SYSTEMROLE;501;2101;Email]

it-leder@eksempel.kommune.no,

Use: Escalation mail when HR child dept has no local approver.


[COUNTEMPLOYEE] / [COUNTMEMBERS]

Evaluated on department or group object respectively.

Object

Expression

Output (dummy)

Department IT

[COUNTEMPLOYEE]

47

Group "Prosjekt Alfa"

[COUNTMEMBERS]

12


[GETLASTSYNCID]

Expression

Output (dummy)

[GETLASTSYNCID]

88421 (latest import file id for company)

Use: Troubleshooting footers in admin mails.


[LASTVALUE;attributeName]

Previous value of field from last import HR history, else current field.

Context

Expression

Output

Before sync Kari had one position

[LASTVALUE;APositionCodeId]

POS-01\|

After adding POS-02

[APositionCodeId]

POS-01\|POS-02\|

Pair with [ARRAYDIFF;[APositionCodeId];[LASTVALUE;APositionCodeId]]POS-02\|.


Positions (multi-position HR)

Position fields share index across pipes: index 0 = first position, 1 = second.

[POSITION;returnField;whereField;matchValue]

Parameter

Purpose

returnField

Position field to return (e.g. APositionCodeName)

whereField

Field to match (e.g. AUnitId)

matchValue

Unit or code to find

Expression

Output

[POSITION;APositionCodeName;AUnitId;IT-100]

Utvikler

[POSITION;APositionCodeName;AUnitId;HR-200]

HR-rådgiver


[POSITIONS;returnField;whereField;matchValue]

Same as [POSITION] but returns aligned pipe string across all positions (empty slot where no match).

Expression

Output

[POSITIONS;APositionCodeName;AUnitId;IT-100]

Utvikler\| (second position empty at same index pattern)


[GROUPPRIMARYPOSITION;returnField]

Picks primary position: highest APositionPercentage, tie-break by earliest APositionStartDate.

Kari positions

Expression

Output

100% IT, 20% HR

[GROUPPRIMARYPOSITION;APositionCodeName]

Utvikler


[ACTIVEPOSITIONCOUNT;asOfDate]

Expression

Output

[ACTIVEPOSITIONCOUNT;17.06.2026 00:00:00]

2 (both positions active on that date)


Messaging and integration

[COUNTMESSAGESENT;messageId;fromDate]

Parameter

Purpose

messageId

Message template id (optional if flow provides context)

fromDate

Only count sends after this date (optional)

Expression

Output (dummy)

[COUNTMESSAGESENT;1936;01.06.2026 00:00:00]

1

Use: "Already notified?" guard in follow-up flow.


[SYSTEMOWNER]

Requires history row from permission change (Add/Edit/Delete permission).

Context

Output (dummy)

Permission on role 501 added

fagsystem-eier@eksempel.kommune.no

Use: CC system owner when automated permission is granted.


[SYNCSTEPPARAMETER;key;companySyncStepId]

Parameter

Purpose

key

Parameter name on sync step

companySyncStepId

Customer sync step instance id

Expression

Output

[SYNCSTEPPARAMETER;ApiBaseUrl;42]

https://api.example.invalid/hr

Access: Company administrator in expression builder preview.


[APITOKEN;apiUsername]

Parameter

Purpose

apiUsername

API user login name (object type 14)

Expression

Output

[APITOKEN;sync.service]

Opaque session token string (varies)

Access: Company administrator in preview. Use only in secured server-side flows.


HTML helpers (message templates)

[HTMLLISTMEMBEROF;displayField]

On a group member user: lists parent groups.

Expression

Output

[HTMLLISTMEMBEROF;Name]

<ul><li>Prosjekt Alfa</li><li>IT-utviklere</li></ul>


[HTMLLISTARRAY;list]

Expression

Output

[HTMLLISTARRAY;Utvikler\|HR-rådgiver]

<ul><li>Utvikler</li><li>HR-rådgiver</li></ul>


Form template controls

Used in form templates, not standard rulesets.

Function

Purpose

[INPUTBOX;fieldId;label;default;value]

Text input bound to form field id

[CHECKBOX;...]

Boolean input

[LISTBOX;...]

Dropdown (five parameters)

[RADIO;...]

Radio group

[DATEBOX;...]

Date picker

[AREABOX;...]

Multi-line text

[BUTTON;...]

Action button

Example pattern: [INPUTBOX;1042;Avdeling;IT-100;] renders input labelled "Avdeling" defaulting to IT-100.

Markers [NOTIFY...], [HIDDEN...], [SERVERFUNCTION...] are form behaviour hooks, not data functions.


End-to-end scenarios (dummy data)

Welcome mail — start date only

Ny ansatt [DisplayName] starter [SUBSTRING;0;10;[Start]].

Output: Ny ansatt Kari Nordmann starter 01.04.2026.


Permission expiry line

Gyldig til: [IFEMPTYUSE;[OBJECTPERMISSION;ExpiryDate;SystemRoleId;501];Permanent tilgang]

Output: Gyldig til: Permanent tilgang


Manager missing — escalate to parent dept manager

[IFEMPTYUSE;
 [EXISTS;[Manager];];
 [REFERENCE;Email;UserId;1;[REFERENCE;Manager;Id;2;[REFERENCE;ParentDepartmentNumber;DepartmentNumber;2;[DepartmentNumber]]]]]

Kari Manager

Output

empty

ola.hansen@eksempel.kommune.no (parent dept manager email)

set

empty (EXISTS branch — adjust template logic if you need manager email when present)

Adjust IFEMPTYUSE/EXISTS pairing to match your template intent; test in expression builder.


New position only — message recipient

After sync adds POS-02:

[REFERENCE;Email;UserId;1;[POSITION;APositionManager;AUnitId;[RTRIM;[ARRAYDIFF;[APositionCodeId];[LASTVALUE;APositionCodeId]];|]]]

Output: Manager email for the new position's unit (dummy: ny-leder@eksempel.kommune.no).


Auto security group name (customer setup)

SG-[Department]-[CLEAN;[OrgUnitnr]]

Output: SG-IT og digitalisering-IT-100 (exact CLEAN output may vary).


Export mapping — samAccountName

[UserName]

Output: kari.nordmann


Ruleset — user has role on system

Rule attribute expression:

[OBJECTPERMISSION.SYSTEMROLE;Name;SystemRoleId;501]

Resolved value: Bruker Fagsystem X — compare with operator Er lik / membership operators.


Expression builder

Item

Detail

Where

Header icon expression builder, message template editors, some eHub screens

Function list

All object fields for selected type plus standard functions

Preview

Pick test user/department/group; requires super manager

Rulesets

Automation → Rulesets — minimum super manager


Troubleshooting

Symptom

Likely cause

Action

Literal [FUNCTION...] in output

Inner field empty or typo

Fix nesting; verify field names on object

Expression evaluation error

Nested [ARRAYFOREACH...]

Split into sibling calls or use [ARRAYJOIN]

Empty string

No matching id / permission

Confirm system role id and system id in system access

Wrong position in mail

Several positions changed at once

Do not rely on ARRAYDIFF/LASTVALUE alone

Preview blocked

Role or protected field

Elevate role or simplify test expression

Works in builder, not in message

Event flow needs object history from sync

Run import; check entry type in history


Quick index

Category

Functions

Date/time

NÅ, NOW, DATEFORMAT, DATEDIFF, DAYOFYEAR

String

SUBSTRING, SPLIT, REPLACE, REPLACELIST, RTRIM, LTRIM, RPAD, LPAD, RIGHT, INITIALS, PRETTIFY, LOWER, UPPER, CLEAN, STRICTCLEAN, CNCLEAN, GETKEYVALUE

Logic

IFTHENELSE, IFEMPTYUSE, EXISTS, TRANSFORM, CONTAINS

Arrays

COUNT, ARRAYAPPEND, ARRAYUNIQUE, ARRAYFILTER, ARRAYDIFF, ARRAYJOIN, ARRAYFOREACH, ARRAYPREFIX, ARRAYTRIM, PRUNEARRAY, UNION

Security

HASH, PASSWORD, UNIQUE, RND, STRRND

Lookup

REFERENCE, OBJECTPERMISSION, OBJECTHISTORIES, FOREACH, DESCENDANTS, SYSTEM, SELECTION, AVAILABLESYSTEM, AVAILABLEROLE, AVAILABLEDEPARTMENTS, DATAOWNER, ANTECEDANTS.SYSTEMROLE, COUNTEMPLOYEE, COUNTMEMBERS, GETLASTSYNCID, LASTVALUE

Positions

POSITION, POSITIONS, GROUPPRIMARYPOSITION, ACTIVEPOSITIONCOUNT

Messaging

COUNTMESSAGESENT, SYSTEMOWNER, SYNCSTEPPARAMETER, APITOKEN

HTML

HTMLLISTMEMBEROF, HTMLLISTARRAY

Forms

INPUTBOX, CHECKBOX, BUTTON, LISTBOX, RADIO, DATEBOX, AREABOX


AI assistant notes

  1. Prefer [DisplayName]-style fields before wrapping in functions.

  2. Ask where the expression lives: ruleset vs message vs export vs customer setup.

  3. Replace dummy ids (501, 2100) with the customer's real system role and department ids from system access.

  4. Position filter on import excludes matches; sync step ruleset includes matches.

  5. Event message flows need object history from a sync run.

  6. Build nested examples inside-out — except [ARRAYFOREACH...], which binds ??? per element before template functions run.

  7. Do not nest [ARRAYFOREACH...]; use sibling calls or [ARRAYJOIN].

  8. Terms: ruleset (Regelsett), message flow (meldingsflyt), system access (systemtilgang), permission (tilgang), object history (objekthistorikk).

Last updated: