Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions guides/uis/fiori.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ You can add your validation logic before the operation handler for either CRUD o

<div id="query-data-draft-enabled" />


### Query Drafts Programmatically

To access drafts in code, you can use the [`.drafts` reflection](../../node.js/cds-reflect#drafts).
Expand All @@ -500,6 +501,42 @@ SELECT.from(Books.drafts) //returns all drafts of the Books entity

[Learn how to query drafts in Java.](../../java/fiori-drafts#draftservices){.learn-more}


### Direct CRUD <Beta />

With <Config>cds.fiori.direct_crud:true</Config>, creating or modifying active instances directly is possible without creating drafts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same config for Node.js and Java?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one yes, because it affects compile to odata. but there will be an additional config for java, afaik.

This comes in handy when technical services without a UI interact with each other.

That is, you can then create and modify active instances directly:

```http
POST /Books

{
"ID": 123
}
```

```http
PUT /Books(ID=123)

{
"title": "How to be more active"
}
```

For this, the default draft creation behavior by SAP Fiori Elements is redirected to a collection-bound action via annotation `@Common.DraftRoot.NewAction`.
The thereby freed `POST` request to draft roots without specifying `IsActiveEntity` leads to the creation of an active instance (as it would without draft enablement).

The 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 Additional entry point
Note that this feature creates additional entry points to your application. Custom handlers are triggered with delta
payloads rather than the complete business object.
:::


## Use Roles to Toggle Visibility of UI elements

In addition to adding [restrictions on services, entities, and actions/functions](../security/authorization#restrictions), there are use cases where you only want to hide certain parts of the UI for specific users. This is possible by using the respective UI annotations like `@UI.Hidden` or `@UI.CreateHidden` in conjunction with `$edmJson` pointing to a singleton.
Expand Down
38 changes: 1 addition & 37 deletions node.js/fiori.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,48 +191,12 @@ It can occur that inactive drafts are still in the database after the configured

## Bypassing Drafts {.deprecated}

Use [Direct CRUD](#direct-crud) instead.
Use [Direct CRUD](../guides/uis/fiori#direct-crud) instead.

Until the next major release (`cds10`), you can still activate the draft bypass without also allowing direct CRUD via <Config>cds.fiori.bypass_draft:true</Config>.



## Direct CRUD <Beta />

With <Config>cds.fiori.direct_crud:true</Config>, 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.

That is, you can then create and modify active instances directly:

```http
POST /Books

{
"ID": 123
}
```

```http
PUT /Books(ID=123)

{
"title": "How to be more active"
}
```

For this, the default draft creation behavior by SAP Fiori Elements is redirected to a collection-bound action via annotation `@Common.DraftRoot.NewAction`.
The thereby freed `POST` request to draft roots without specifying `IsActiveEntity` leads to the creation of an active instance (as it would without draft enablement).

The 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 Additional entry point
Note that this feature creates additional entry points to your application. Custom handlers are triggered with delta
payloads rather than the complete business object.
:::



## Programmatic APIs <Beta />

You can programmatically invoke draft actions with the following APIs:
Expand Down