From 99bb7d45d9b52edce0c33971e3b19504b0c955d5 Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Thu, 1 Feb 2024 15:07:46 +0100 Subject: [PATCH] feat(draft): Bypassing Draft Restrictions (#639) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(draft): SAP Fiori Elements Mass Edit * add warning disclaimer * more broader context * minor * Update node.js/fiori.md Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> * add samples * add link to SAP Fiori Elements Mass Edit page * Apply suggestions from code review Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> * Update node.js/fiori.md Co-authored-by: René Jeglinsky * formatting * fix merge conflict --------- Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> Co-authored-by: René Jeglinsky --- node.js/fiori.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/node.js/fiori.md b/node.js/fiori.md index 823ee810a..f93630e0b 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -86,6 +86,51 @@ To prevent inconsistency, the entities with draft are locked for modifications b cds.drafts.cancellationTimeout=1h ``` +### Bypassing the SAP Fiori Draft Flow + +Creating or modifying active instances directly is possible without creating drafts. This comes in handy when technical services without a UI interact with each other. + +To enable this feature, set this feature flag in your configuration: + +```json +{ + "cds": { + "fiori": { + "bypass_draft": true + } + } +} +``` + +You can then create active instances directly: + +```http +POST /Books + +{ + "ID": 123, + "IsActiveEntity": true +} +``` + +You can modify them directly: + +```http +PATCH /Books(ID=123,IsActiveEntity=true) + +{ + "title": "How to be more active" +} +``` + +This feature is required to enable [SAP Fiori Elements Mass Edit](https://sapui5.hana.ondemand.com/sdk/#/topic/965ef5b2895641bc9b6cd44f1bd0eb4d.html), allowing users to change multiple objects with the +same editable properties without creating drafts for each row. + +:::warning +Note that this feature creates additional entry points to your application. Custom handlers are triggered with delta +payloads rather than the complete business object. +::: + ### Garbage Collection of Stale Drafts Inactive drafts can be deleted automatically after a timeout. You can configure this timeout by the following configuration: