Nuclos SaveFlags: SaveFlag.PATCH and SaveFlag.SKIP_RULES on update in rules, load attributes restricted, load version, performance.

globe with meridians Language: Deutsch · English

open book SaveFlags

Control saving: write individual attributes with SaveFlag.PATCH and skip update rules with SKIP_RULES.

Auf dieser Seite

SaveFlags on update

From Nuclos 4.2024.19, SaveFlags can be passed when updating a BO in rules:

SaveFlagEffectsince
SaveFlag.SKIP_RULESprevents subsequent update rules (final rules still run)4.2024.19
SaveFlag.PATCHwrite individual attributes without loading all of them4.2024.21

Example

Previously the whole record was loaded and saved:

Article article = Article.get(articleId);
article.setPrice(BigDecimal.valueOf(7.99));
article.save();

Since 4.2023.33 records can be loaded restricted to certain attributes. When saving, the PATCH flag is then required – and the version must be loaded too:

// nur bestimmte Attribute laden (inkl. Version) und patchen
Article article = Article.get(articleId, Article.Price, Article.Version);
article.setPrice(BigDecimal.valueOf(7.99));
article.save(SaveFlag.PATCH, SaveFlag.SKIP_RULES);

Also use SKIP_RULES so no unwanted update rules are triggered.

Related pages

open book Server-side rules


Saving in rules.

Öffnen →

gear Selectively disabling rule execution


Suppress rules.

Öffnen →