TwinaForms Help
Writing formulas in TwinaForms.
Formulas compute a field's value live as users fill the form — from simple concatenations like a full name, to totals, date math, and conditional messages. This page is a practical reference with copy-paste examples.
Where formulas work
Turn any Text or Number field into a formula field from the Designer's Element Properties panel. The field becomes read-only in the published form and recomputes every time a source field changes.
- Recalculates live as the user types.
- Submits the computed value to Salesforce along with everything else.
- Formulas can reference input fields, but not other formula fields (no formula‑to‑formula chains in v1).
- Not yet available inside repeat groups.
Syntax basics
Field references
Wrap a field's Internal Name (ID) in curly braces. Internal IDs are auto-generated and look like text2, number4, email5, checkbox11, radio10 — not the friendly label you typed.
{text2}
{number4}
{checkbox11}
You don't have to type them. In the formula editor use the Insert field dropdown (the list shows each field's friendly label with its internal ID in parentheses) and click Insert — the correct reference is placed at the cursor.
Literals
- "Hello" — string (double quotes).
- 42, 3.14, -1 — numbers.
- true, false — booleans.
Function calls
Function names are uppercase. Arguments are separated by commas.
IF({isVip}, "Priority", "Standard")
CONCAT({firstName}, " ", {lastName})
❌ IF({status} = "Open", "Yes", "No")
✅ IF({status} == "Open", "Yes", "No")
Operators
Arithmetic
{quantity} * {unitPrice}
({subtotal} + {tax}) - {discount}
Comparison
String comparisons are case-sensitive. Use IF({rating} == "Hot", …) with the exact picklist value.
Logical
IF({total} > 100 and {isMember}, "Member discount", "")
Examples
Copy, paste into a Text or Number formula field, and replace the field references with yours.
Full name from two fields
Text formula. Uses CONCAT so "John" + " " + "Doe" becomes "John Doe".
CONCAT({firstName}, " ", {lastName})
Line total
Number formula. Multiplies quantity by unit price.
{quantity} * {unitPrice}
Line total with tax, rounded to cents
Number formula. The outer ROUND keeps the result to two decimals.
ROUND({quantity} * {unitPrice} * 1.17, 2)
Equality check — IF(A == B, …)
Text formula. Compare a field to a literal value using ==. String comparisons are case‑sensitive, so match the exact picklist or input value.
IF({rating} == "Hot", "Contact today", "Regular follow-up")
VIP greeting
Text formula. Shows a personalized line only for members.
IF({isMember},
CONCAT("Welcome back, ", {firstName}, "!"),
CONCAT("Hello, ", {firstName}))
Default to "N/A" when a field is empty
Text formula. COALESCE returns the first non-blank argument.
COALESCE({nickname}, {firstName}, "N/A")
Age from a date of birth
Number formula. Approximate age using year difference.
YEAR(TODAY()) - YEAR({dateOfBirth})
Discount band
Text formula. Nested IF forms a simple tiered rule.
IF({orderTotal} >= 1000, "Gold",
IF({orderTotal} >= 500, "Silver",
IF({orderTotal} >= 100, "Bronze", "Standard")))
Shipping fee rule
Number formula. Free shipping above $100, otherwise flat $9.90.
IF({orderTotal} >= 100, 0, 9.90)
Case reference
Text formula. Builds a unique-looking id the user can quote in support.
CONCAT("REF-", YEAR(TODAY()), "-", {email})
Day of the week for a chosen date
Text formula. DAYNAME follows the form's language, so a Hebrew form shows יום שישי.
DAYNAME({appointmentDate})
Block weekend bookings
Text formula. WEEKDAY returns 1 for Sunday through 7 for Saturday.
IF(OR(WEEKDAY({appointmentDate}) == 6, WEEKDAY({appointmentDate}) == 7),
"Please pick a weekday", "")
Date and time to a Salesforce date-time field
Text formula on a hidden field. Joins a Date field and a Time field into one value that Salesforce reads as a date-time. Then, in Submit Actions, map this hidden field to the Salesforce date-time field. A Date field reads as YYYY-MM-DD and a Time field as HH:mm (24-hour) in a formula, whatever format the person sees.
TZDATETIME({startDate}, {startTime}, "Asia/Jerusalem")
The third part is the time zone name. 10:00 entered by the person is saved as 10:00 in that zone, with the right summer or winter offset for that date. Salesforce stores it in UTC and shows each user their own time. The result is blank until both the date and the time are filled in. Use "UTC" for UTC.
The current time in a time zone
Text formula on a hidden field. NOW() is the visitor's own clock, with no time zone. Give NOW a zone name and you get that zone's time with the exact offset, ready for a Salesforce date-time field, whatever country the visitor is in.
NOW("Asia/Jerusalem")
On 6 October 2026 at 16:32 in Jerusalem this gives 2026-10-06T16:32:28+03:00. In winter the same formula ends in +02:00.
Time zone names
The zone goes in quotes as a name of the form Region/City, spelled exactly like this, with underscores instead of spaces. In the formula editor, use Find a time zone under the formula buttons: type a city, such as Los Angeles, and click the result to put the name in the formula. If a name is not valid, the editor says Unknown time zone and does not let you save.
- Asia/Jerusalem — Israel
- Europe/London — United Kingdom
- Europe/Paris, Europe/Berlin, Europe/Madrid
- America/New_York — US Eastern
- America/Chicago — US Central
- America/Denver — US Mountain
- America/Los_Angeles — US Pacific
- Asia/Dubai, Asia/Kolkata, Asia/Tokyo
- Australia/Sydney
- UTC — no offset
Limits & gotchas
- String comparisons are case-sensitive. "Hot" == "hot" is false.
- Empty fields become null, not an empty string. Wrap with COALESCE({field}, "") if you need a safe default.
- Dates are browser-local. A user in Tel Aviv and one in New York can see different TODAY() values for a few hours each day.
- No formula-to-formula references. If you need a nested calculation, inline it in a single expression.
- No support inside repeat groups yet. Place formulas on top-level fields only.
- Formula fields ignore prefill. The source fields prefill normally and the formula recalculates from them.
- Invalid input returns null. VALUE("hello") is blank, not zero.