language area · Absence

Optional values

A search that may find nothing gives an optional value: resolve it with or, or test it with if, and the compiler narrows it to present.

Implementation
Implemented published in npm 0.1.0
Kind
Mynt language, not a SuiteScript method
A

Supported · compiles today

mynt
1let owner = search Customer2    where email === "owner@example.com"3    first4    or return5log.debug(owner.comments)6 7let match = search Customer8    where comments === "VIP"9    first10if match {11    log.debug(match.email)12}
suitescriptoutput, trimmed
1const owner$maybe = mynt$search(search.Type.CUSTOMER, ["comments"], [], [["email", search.Operator.IS, "owner@example.com"]], undefined, true);2if (owner$maybe === null) {3    return;4}5const owner = owner$maybe;6 7const match = mynt$search(search.Type.CUSTOMER, ["email"], [], [["comments", search.Operator.IS, "VIP"]], undefined, true);8 9if (match !== null) {

After or return the local is never absent; inside if match neither is match. Reading a field of an optional without either is an error.

B

Published on npm since 0.1.0. Verified with mynt build on 13 Oct 2026.

  1. Reached the compiler.
  2. Published in Mynt 0.1.0.
C

SuiteScript methods this feature lowers to or works through. They are counted on their own pages, never through the feature.