PersistentRecord setString not updating value

I am updating the following value on a persistent record to maintain the status of an object:

public static final StringField Status = new StringField(META, "Status", SFieldFlags.SMANDATORY, SFieldFlags.SDESCRIPTIVE).setDefault("Created");

public void setStatus(String status) {
        logger.debug("Setting status for " + this.getName() + " to " + status);
        this.setString(Status, status);
    }

And am calling it in the following way:

List<BaseRecord> baseRecords = context.getPersistenceInterface().query(new SQuery<>(BaseRecord.META));
for (BaseRecord SettingsRecord : baseRecords) {
    DatabaseConnector connector = gateway.getConnector(SettingsRecord.getName());
    boolean isConnected = connector.verifyConnectivity();
    boolean enabled = SettingsRecord.getBoolean(BaseRecord.Enabled);

    String status = (isConnected) ? "Valid" : "Faulted";
    status = (enabled) ? status : "Disabled";
    SettingsRecord.setStatus(status);
}

And I can see in the logs where my code is trying to update the statuses:

But for some reason they are never updating. I tested it out by making the value visible in the config form and updating it manually to “TEST” and I don’t ever see it change from that value, even with the logs saying it should.

You need to actually call into the ORM to persist your changes to the object. You can probably just use:
context.getPersistenceInterface().save(SettingsRecord);
As the last line in your loop.

This was exactly what I needed! Thanks Paul