Skip to Content
0
Jun 08, 2020 at 03:06 PM

How to prevent ID from displaying in a codelist based valuelist

488 Views

I have a very simple schema involving two entities Promotions and Organizations. Organizations is a aspect using CodeList and has only one column ID which is setup as key. I have annotated them by assuming Promotions as equivalent of Books and Organizations as equivalent of Genres from the capire sample. However in draft edit mode the ID shows up in the valuelist and on selection the Organization ID value gets populated. This behaviour is different from the behaviour for Genres. I do not have any nodejs code and am using the Fiori previews for the Promotions

-- schema.cds
entity Organizations : CodeList{ 
key ID : Integer;
} 

entity Promotions : cuid { 
organization : Association to Organizations; 
promotion_name : String(80); 
clnt_code : String(80); 
promotion_number : String(80) ; 
}

-- pricing_fiori.cds --
annotate pricing.Promotions with @(
    Common.SemanticKey: [promotion_name],
    UI: {
        Identification: [{Value:promotion_name}],
      SelectionFields: [ promotion_name, promotion_number ],
        LineItem: [
            {Value:organization.name},
            {Value: promotion_name},
            {Value: promotion_number},
        ]
    }
){
    organization @ValueList.entity:'Organizations';
};


annotate pricing.Promotions with @(
    UI: {
    HeaderInfo: {
        TypeName: 'Promotion',
        TypeNamePlural: 'Promotions',
        Title: {Value: promotion_name},
        Description: {Value: organization.name}
    },
    }
);

annotate pricing.Promotions with {
    ID @title:'ID' @UI.HiddenFilter;
    promotion_name @title:'Promotion Name';
    promotion_number @title:'Promotion Number';
//  organization_ID @title: 'orga';
    organization @title:'Organization'
    @Common: { Text: organization.name, TextArrangement: #TextOnly };
}

annotate PricingService.Promotions with @(
    UI: {
        Facets: [
            {$Type: 'UI.ReferenceFacet', Label: '{i18n>General}', Target: '@UI.FieldGroup#General'},
        ],
        FieldGroup#General: {
            Data: [
                {Value: promotion_name},
                {Value: organization_ID },
                {Value: organization.name},
                {Value: promotion_number},
            ]
        }


annotate PricingService.Promotions with @(
    UI: {
      SelectionFields: [ ID, promotion_name ],
        LineItem: [
            {Value: promotion_name},
            {Value: promotion_number, Label:'Promo Number'},
            {Value: organization.name},
        ]
    },
);


annotate pricing.Promotions with @fiori.draft.enabled;
annotate PricingService.Promotions with @odata.draft.enabled;

annotate pricing.Organizations with @fiori.draft.enabled;
annotate PricingService.Organizations with @odata.draft.enabled;






Attachments