🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators maxLength
Created by Lars.olofsson on 2020-06-29 · Last edited by Peter.byaruhanga on 2025-12-10.

Returns the maximum length allowed for a string attribute.

Useful for cutting a string to fit an attribute and avoiding SQL errors when saving.

Example

Given a Class Car with string attribute Name

Car.allInstances->first.Name.maxLength

This will return the maximum length for the string attribute Name

See: String attribute overflowing