def definition = record.getDefinition()
definition.getFullIdentifier()
definition.hasFieldDefinition("io_showcase_integer")
definition.getFieldDefinition("io_showcase_integer").getDatatype()
def record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.io_showcase_integer = 100
Database.update(record)
record.changed() //will return truedef record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.io_showcase_integer = 1500
Database.update(record)
record.isFieldChanged("io_showcase_integer") //will return truedef record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.io_showcase_integer = 1200
record.io_name = "new name"
Database.update(record)
record.getChangedFields() //returns a map with the changed fields, the key is the field's UUID and the value is the new valuedef record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.io_name = "my new name"
Database.update(record)
record.getOldFieldValue("io_name") // returns the value before the changeThe Max platform automatically validates records before data is persisted to the database. |
def record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.io_name = ""
record.isValid() //returns false as the io_name field is requiredThe Max platform automatically serializes records generated during an operation, if the operation is configured to do so. |
def record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.serialize() //this will return the JSON containing the full serialized entitydef record = Database.querySingleResult("select * from io_showcase where io_uuid = '42f64596-c42f-4ba2-8138-cc40188d2a88'")
record.setFieldsToSerialize(["io_uuid", "io_name"])
record.serialize() //this will return the JSON containing only the fields indicated plus a subset of platform fields