You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advanced/fiori.md
+13-18Lines changed: 13 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -472,34 +472,29 @@ For more details, see the [official UI5 documentation](https://ui5.sap.com/#/top
472
472
473
473
### Validating Drafts
474
474
475
-
CAP provides _state messages_ to the UI5 OData V4 model. This enables validations of drafts and giving feedback about errors to users faster in the UI.
476
-
477
-
::: warning Requires OData V4 and UI5 version >=1.135.0
478
-
The _state messages_ feature relies on UI5 to use _document URLs_. That's because, with this feature enabled, CAP sets the annotation `@Common.AddressViaNavigationPath` to instruct UI5 to use _document URLs_. In turn, this requires OData V4 and UI5 version >= 1.135.0. OData V2 does not support the annotation.
479
-
:::
480
-
481
-
If required, for example because of usage of OData V2, this feature can be disabled with <Config>cds.fiori.draft_messages:false</Config>.
482
-
483
-
This feature adds additional elements to your draft-enabled entities and [`DraftAdministrativeData`](/guides/security/data-protection-privacy#dpp-cap), which are required to store and serve state messages. For this to work, the CAP runtimes support persisting (error) messages for draft-enabled entities.
484
-
485
-
In addition, you can observe the following improvements, without any changes to the application code:
486
-
487
-
- Error messages for annotation-based validations (for example, `@mandatory` or `@assert...`) already appear while editing the draft.
488
-
- Custom validations can now be registered to the `DRAFT_PATCH` event and can write (error) messages. It's ensured that the invalid value is still persisted, as expected by the draft choreography.
489
-
- Messages no longer unexpectedly vanish from the UI after editing another field.
490
-
- Messages are automatically loaded when reopening a previously edited draft.
491
-
492
-
By default, when activating this state messages, side-effect annotations are generated in the EDMX that instruct UI5 to fetch state messages after every `PATCH` request. If you require more precise control over side-effect annotations, you can disable the side-effect annotation per entity:
475
+
With Fiori draft state messages, you benefit from the following improvements without any change in your application code:
476
+
- The UI displays error messages for annotation-based validations (such as `@mandatory` or `@assert...`) while editing drafts.
477
+
- You can register [custom validations](#custom-validations) to the `PATCH` event and write (error) messages. The draft choreography ensures the invalid value still persists.
478
+
- Messages remain visible in the UI, even after editing other fields.
479
+
- The UI automatically loads messages when reopening a previously edited draft.
480
+
CAP generates side-effect annotations in the EDMX to instruct UI5 to fetch state messages after every `PATCH` request. To control side-effect annotations more precisely, override or disable them per entity:
493
481
494
482
```cds
495
483
// Setting `null` disables the side-effect annotation for always fetching messages.
496
484
annotate MyService.MyEntity with @Common.SideEffects #alwaysFetchMessages: null;
497
485
```
498
486
487
+
To enable this feature, CAP adds additional elements to your draft-enabled entities and [`DraftAdministrativeData`](/guides/security/data-protection-privacy#dpp-cap) to store and serve the state messages. CAP runtimes persist (error) messages for draft-enabled entities.
488
+
499
489
::: warning Requires Schema Update
500
490
This feature initiates a database schema update, as it adds an additional element to `DraftAdministrativeData`.
501
491
:::
502
492
493
+
::: warning Requires OData V4 and UI5 version >=1.135.0
494
+
State messages require UI5 to use _document URLs_. CAP sets the `@Common.AddressViaNavigationPath` annotation to enable this. You need OData V4 and UI5 version >= 1.135.0. OData V2 does not support this annotation.
495
+
:::
496
+
To disable this feature, set <Config>cds.fiori.draft_messages:false</Config>.
0 commit comments