M3-S2 — Expressions: calculated, locked and conditional fields
Section titled “M3-S2 — Expressions: calculated, locked and conditional fields”| Module | M3 — Advanced automation |
| After this session you can | Put a rule that uses the record’s own values into the designer as a formula, and know when it belongs somewhere else. |
| Time | Facilitated: 42 min · On your own: 42 min |
| Before you start | M3-S1. The starter application of Nour Hamdan waits at Interview L1. Signed in as yourself; Hala Mansour in a private window. |
| Go deeper | Calculated values · Field configuration reference: calculated values · Functions vs the expression engine |
◆ Orientation (1 min) — The low-code rung
Section titled “◆ Orientation (1 min) — The low-code rung”In ACD you typed formulas the docs gave you: a cron schedule, a placeholder. In M1-S1 you decided which of Meridian’s rules are low-code. This session teaches you to write them: a score the system calculates and keeps locked, and fields that hide themselves when they do not apply. The score you build here is what M3-S3 uses to route strong candidates.
▤ Concept (5 min) — Where expressions live and how they behave
Section titled “▤ Concept (5 min) — Where expressions live and how they behave”Six places for a formula
Section titled “Six places for a formula”| Place in the designer | What the expression returns | Example |
|---|---|---|
| A field’s Default Value › Advanced › Type expression | The field’s value | An average of two scores |
| Lock Field or Hide Field › Conditional expression | True or false: locked or hidden while true | Hide the meeting link for an in-person interview |
| A reaction action’s value, Value type Expression | The value to write or send | A due date ten days from today |
| A step’s Timing, Timing method Expression | A number of time units | A shorter limit for urgent requests |
| A step’s owner or an action’s Expression based target | An owner, or true or false for a route | M3-S3 |
| A query condition with an Expression value | A value of the field’s own type | A date string, a number, a user reference |
The language
Section titled “The language”Expressions are JavaScript expressions. The record’s values are under value, by each field’s
normalized name: value.price * value.quantity. A field inside a block has a full normalized
name that includes the block’s, which the Structure tab shows; in the starter’s Interview
L1 block that gives value.interview_l1.technical_score. In a query condition there is no
record in scope, so there the expression works only with the current moment and the person, and
must return exactly the type the field stores: a number for a Number field (10, not '10'), a
date string such as 2026-12-01 for a Date field, not a date object.
How a calculated field behaves
Section titled “How a calculated field behaves”A calculated field is evaluated twice: live in the form as you type, and again on the server when the record is saved. Lock Field plus an Advanced value is how you build a field the system maintains: a locked field ignores any value someone sends, from the form, a reaction or the API, and keeps its calculation. With Lock Field on, Execution Triggers appears:
| Trigger | Recalculates | Use it when |
|---|---|---|
| On page load | When a new record’s form opens | A starting value, never updated |
| On save | Each time the record is saved | The value depends on many fields |
| On entry change | Whenever the record changes | Rarely: it runs on every change |
| On field change | When one of the Watched fields changes | A value derived from a few named fields |
Execution Scope decides which saves recalculate on the server: New entries, Existing entries or All entries. Choose the trigger first, because changing it resets the scope to New entries. A value meant to stay current needs All entries: with no scope, the server never recalculates it on save, so a record changed by a reaction or an integration keeps a stale value.
Writing expressions that do not fail quietly
Section titled “Writing expressions that do not fail quietly”A wrong expression rarely shows an error; it shows nothing, or the wrong thing. Three habits prevent most of it:
- Guard empty values. A score not yet entered is empty, and empty plus a number is not a
number. Write
(Number(value.a) || 0). - Return the field’s type. A Number field needs a number; round it if people read it.
- Test the edges. Empty fields, zero, the largest value, and a record saved by a reaction.
Expressions are code. Anyone with Developer access to an entity can write one, which is one more reason that access is given deliberately (M7). When a formula needs comments to be understood, outside data, or a rule table, it has outgrown the designer: that is a Function (M4).
⛏ Lab (29 min) — The overall interview score and the self-hiding fields
Section titled “⛏ Lab (29 min) — The overall interview score and the self-hiding fields”Goal. Overall L1 score is calculated from two scores, locked, and kept current; the interview link shows only for a virtual interview, the location only for one in person.
Before you start. Signed in as yourself.
The calculated score
-
Edit Job Application. In the Interview L1 block, add two Number fields, Technical score and Communication score, each from 0 to 10.
-
Add a third Number field, Overall L1 score. Under Field Attributes, turn on Lock Field.
-
In Default Value, tick Advanced, and in Type expression enter:
Math.round(((Number(value.interview_l1.technical_score) || 0) + (Number(value.interview_l1.communication_score) || 0)) / 2 * 10) / 10Check the two normalized names on the Structure tab first and use what it shows.
-
In Execution Triggers, choose On field change, and in Watched fields pick Technical score and Communication score. Then set Execution Scope to All entries.
The conditional fields
- Open Interview link in the same block. Turn on Hide Field and enter the Conditional
expression
!value.interview_l1.virtual_interview. - Open Interview location. Turn on Hide Field with
value.interview_l1.virtual_interview === true. - Select Save, then Save Changes.
The step’s field rules
- Open the Workflows tab, the Interview L1 step, and its Requirements. Set Technical score and Communication score to Mandatory, and Overall L1 score to Locked. Save the workflow.
Screenshot pending The Default Value settings of Overall L1 score: Advanced ticked, the averaging expression, On field change with the two scores watched, and Execution Scope All entries What to notice: the trigger watches only the two scores, and the scope is All entries, so a score changed later by anyone, or by the API, still updates the overall score.
Prove it
- As Hala Mansour, open Nour Hamdan’s application at Interview L1 (select Take Ownership if asked). Enter Technical score 9: Overall L1 score shows 4.5. Enter Communication score 8: it shows 8.5.
- Try to type into Overall L1 score: it is locked. Save the application.
- Edit the application and switch Virtual interview? on and off: Interview link and Interview location swap.
Check.
- Overall L1 score is locked, with the expression, On field change watching the two scores, scope All entries.
- The expression guards empty scores (4.5 with one score entered).
- Interview link and Interview location hide by the value of Virtual interview?.
- At Interview L1 the two scores are mandatory and the overall score is locked.
- Nour Hamdan’s saved application shows Overall L1 score 8.5.
Pass condition. On Nour Hamdan’s application the overall score follows the two scores as they are typed, cannot be typed over, and is saved as 8.5.
If something goes wrong
| What you see | What to do |
|---|---|
| Overall L1 score stays empty | A normalized name in the expression does not match the Structure tab, or the watched fields are not the two scores. |
It shows NaN or nothing with one score | The ` |
| It updates in the form but not after a reaction changes a score | Execution Scope is empty or New entries; set All entries. |
| Both interview fields stay visible | The conditional expressions refer to the wrong name for Virtual interview?. |
| Execution Triggers is missing | Lock Field is off; the triggers appear only for a locked field. |
Model answer
Overall L1 score is a system-maintained field: Lock Field on, an Advanced default that averages the two scores with empty values treated as 0 and rounds to one decimal, recalculated On field change of exactly those two scores, for All entries. Locking means no form, reaction or API call can overwrite it; the scope means the server recalculates it whenever either score changes, from anywhere. The two conditional fields are the cheapest kind of expression: a true or false that the form re-evaluates as people type.
◇ Worked scenario (1 min) — Three formulas, three homes
Section titled “◇ Worked scenario (1 min) — Three formulas, three homes”A builder brings three rules. Decide where each belongs before reading on.
1. “Set Due date to ten days after the task is assigned.” It needs a value written at a moment (the assignment), not kept in step with other fields. Decide. A reaction on the assignment that writes Due date with Value type Expression. A calculated field would recalculate whenever its trigger fires and could move the date after it was agreed.
2. “Show only the applications whose interview is in the next seven days.” Decide. A query
condition on Interview date with a date pointer such as @today('+7d'). Pointers, not record
values, belong in queries, because a query has no record in scope.
3. “Work out the notice period from the contract type, the grade and the country, using HR’s policy table.” Decide. Not an expression: a policy table that HR revises belongs in a Function (M4), where it can be tested.
Where a formula lives depends on when its value must be decided and what it needs to read, not on how long it is.
✓ Practice (5 min) — Check your formulas
Section titled “✓ Practice (5 min) — Check your formulas”A Total field is calculated from Quantity and Unit price with On field change, but the builder left Execution Scope empty. An integration later updates Quantity through the API. What happens to Total?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
A calculated Average shows nothing until both of its two inputs are filled in. Which change fixes it?
Check your answer
The correct answer is C. Open the explanation under each option to see why.
A query must find records whose Due date (a Date field) is today. A builder writes the
Expression value new Date(). Nothing matches. Why?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
A reaction writes 7 into a field that has Lock Field on and an Advanced calculated value. The field ends up holding 7.
Check your answer
The correct answer is B (False). Open the explanation under each option to see why.
↺ Recap (1 min) — Formulas with a home
Section titled “↺ Recap (1 min) — Formulas with a home”You can put a formula in the right place, build a calculated field the system keeps current and locked, hide or lock fields by a condition, and write expressions that survive empty values and writes from elsewhere.
Next. In M3-S3 the score decides the route: strong candidates go straight to the offer, a panel of three decides the second interview, and an owner is worked out by a formula.