Model Object
propertyIsPresent()
Signature
Section titled “Signature”propertyIsPresent() — returns boolean
Available in: model
Category: Miscellaneous Functions
Description
Section titled “Description”Returns true if the specified property exists on the model and is not a blank string. This is the inverse of propertyIsBlank() which checks that a property is either missing or empty.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
property | string | yes | — | Name of property to inspect. |
Examples
Section titled “Examples”1. Property exists with a value
employee = model("employee").new();
employee.firstName = "Dude";
writeOutput(employee.propertyIsPresent("firstName")); // true
2. Property exists but is blank
employee.firstName = "";
writeOutput(employee.propertyIsPresent("firstName")); // false
3. Property does not exist on the model
writeOutput(employee.propertyIsPresent("nonexistentProperty")); // false
4. Conditional logic
if (!employee.propertyIsPresent("email")) {
writeOutput("Email is required.");
}