2025 Feb 09 1:00 PM - edited 2025 Feb 09 1:02 PM
Hi,
In a list report on the detail page (object page) , I'm not understanding in general how custom action bound to an entity is to be implemented. I like to update table Content on an object page with an action related to the current displayed entity which is bound to the object page.
The Fiori sdk docu is confusing, the flexible programming odel homepage with section "custom Actions" is not really helpful, does not explain in comments what should be done.
My main entity is SystemKinds, my table on the object page is SystemKinds.texts . I simply like to add a custom action in the toolbar of table SystemKinds.Texts. Because of having bound the object page to SystemKinds, I assume I have to use "bound action". Once the button is pressed, "title" value should be entered by the user.
I also know that I need side effect once the button on a new action is pressed in order to get values in the SystemKinds.texts updated.
Is there a sample which I can check? In the Fiori Show case app, I cannot find my case.
I need the Fiori annotation for the UI and manifest Setup. I tried different things but nothing works.
I need a short advice in Fiori Setup (annotations with UI) . The action is "setSystemKindsTitles".
Backend Looks like:
entity SystemKinds as projection on paltr.BaseSystemKinds
actions {
@(Common.SideEffects: {TargetEntities: ['in/texts']})
action setSystemKindsTitles(
@( UI.Placeholder:'{i18n>Paltr_Common_InputTitlePlaceHolder}',
title:'{i18n>Paltr_Common_InputTitle}'
)
title : String);
};
// --- SystemKinds.texts ---
@Capabilities: {
Insertable : false,
Deletable : false,
Updatable,
NavigationRestrictions: {Navigability: #None, }
}
entity SystemKinds.texts as projection on paltr.BaseSystemKinds.texts;
In my Service,I have implemented:
...
class AdminConfigurationService extends cds.ApplicationService {
const { SystemTypes, SystemKinds } = this.entities;
if (SystemKinds.texts) {
this.on('setSystemKindsTitles', SystemKinds, async (req) => {
if (!!SystemKinds.texts?.drafts) {
await this.update(SystemKinds.texts.drafts, req.data.ID).with({ title: req.data.title });
}
});
}
...
}
My currently used Fiori UI looks like the following:
using AdminConfigurationService as service from '../../srv/paltr.service.core.adminconfiguration';
annotate service.SystemKinds with @(
// Listreport SystemKindList
UI.LineItem : [
{
$Type: 'UI.DataField',
Value: title,
},
{
$Type: 'UI.DataField',
Value: isPreset,
},
{
$Type: 'UI.DataField',
Value: isUsable,
},
],
// SystemKindObjectPage
UI.HeaderInfo : {
TypeName : '{i18n>Paltr_SystemKind}',
TypeNamePlural: '{i18n>Paltr_SystemKinds}',
Title : {
$Type : 'UI.DataField',
Value : techName,
![@UI.Importance]: #High,
![@UI.Hidden] : false,
},
},
// SystemKindObjectPage - section General Information
UI.FieldGroup #Paltr_GeneralInformationFieldGroup : {
$Type: 'UI.FieldGroupType',
Data : [
{
$Type: 'UI.DataField',
Value: techName,
},
{
$Type: 'UI.DataField',
Value: ID,
},
{
$Type : 'UI.DataFieldForAnnotation',
Target: '@UI.ConnectedFields#Paltr_GeneralInformationConnected',
Label : '{i18n>Paltr_LastChange}',
},
{
$Type: 'UI.DataField',
Value: isPreset,
},
],
},
UI.ConnectedFields #Paltr_GeneralInformationConnected: {
$Type : 'UI.ConnectedFieldsType',
Template: '{modifiedBy}{modifiedAt}',
Data : {
$Type : 'Core.Dictionary',
modifiedBy: {
$Type: 'UI.DataField',
Value: modifiedBy,
},
modifiedAt: {
$Type: 'UI.DataField',
Value: modifiedAt,
},
},
},
// SystemKindObjectPage - section Settings
UI.FieldGroup #Paltr_SettingsFieldGroup : {
$Type: 'UI.FieldGroupType',
Data : [
{
$Type: 'UI.DataField',
Value: isUsable,
}],
},
UI.Facets : [
//Section General Information
{
$Type : 'UI.ReferenceFacet',
ID : 'SystemKind_GeneralInformationFacet',
Label : '{i18n>Paltr_GeneralInformation}',
Target: '@UI.FieldGroup#Paltr_GeneralInformationFieldGroup',
},
//Section Settings
{
$Type : 'UI.CollectionFacet',
Label : '{i18n>Paltr_BaseData}',
ID : 'SystemKind_SettingsFacet',
Facets: [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Paltr_Settings}',
ID : 'SystemKind_SettingsGroupFacet',
Target: '@UI.FieldGroup#Paltr_SettingsFieldGroup',
}],
},
// Translations table
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Paltr_Translations}',
ID : 'Paltr_Translations',
Target: 'texts/@UI.LineItem#Paltr_Translations',
},
],
);
annotate service.SystemKinds.texts with @(UI.LineItem #Paltr_Translations: [
{
$Type : 'UI.DataField',
Value : locale,
Label : '{i18n>Paltr_Sprache}',
![@UI.Importance]: #High,
},
{
$Type : 'UI.DataField',
Value : title,
![@UI.Importance]: #High,
},
]);
The new action shoud appear in the toolbar of "Translations table". I have deleted all my own trials around actions.
Any help would be great.
Yours
Stephan
Request clarification before answering.
Hi Stephen,
Sorry for the delay in reverting and thanks for the detailed explanation! From your description, it seems you need to define the sc-called "static " action - more in the same page. These are bound to the entity rather than the specific instance of the entity (unlike the bound actions) and when they are invoked, you should still be able to get the entity to which they are bound to. Did you give this a try?
Best Regards,
Sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.