cancel
Showing results for 
Search instead for 
Did you mean: 

Invalidating Value Helps via Side Effects in SAP Fiori Elements

SebastianEsch
Active Participant
0 Kudos
802

Hi,

I'm trying to create a side effect in my SAP Fiori Elements App for OData V4 that refreshes the value help when a property has changed. The examples in the Flexible Programming Model Explorer only show how to achieve that for an action. (Example 7 - the SideEffect for the Delete Business Partner Action is in the code for Sample 8).

In my example I have an Object Page for an Organisation with a Table with LineItems of Organisation Members, each Organisation Member has in Edit Mode a Value Help field to choose a User - the User Value Help implementation filters users so that only Users are shown that are not yet members of the organisation.

That means every time a user picks a User from the Value Help, the side effect should force the Fiori Elements app to reload the value help to exclude the previously selected user. But the side effects does not trigger, the value help is fetched when the Value Help Dialog is opened the first time, but then only if the draft is saved and you click on edit again.

My annotation in the annotations.cds file of the Fiori Elements application looks like this:

Common: {
    SideEffects #updateUserFields : {
        SourceProperties: [user_ID],
        TargetProperties: ['user/*']
    },
    SideEffects #updateValueHelp : {
        SourceProperties: [user_ID],
        TargetEntities: ['/OrganisationsService.EntityContainer/UsersValueHelp']
    }
}

The first side effect to update all user related fields of the members entity works fine. The second side effect is the one that does not tigger.

Looking at the SAPUI5 documentation at https://ui5.sap.com/#/topic/18b17bdd49d1436fa9172cbb01e26544 - Value List Refresh (at the bottom of the page), I would expect my approach to work.

The example in the FPM Explorer only shows how an action refreshes the value list: https://ui5.sap.com/test-resources/sap/fe/core/fpmExplorer/index.html#/advancedFeatures/guidance/gui... - Example 7.

Kind regards,

Sebastian

Andreas_M
Explorer
0 Kudos

Hi Sebastian,

I have the exact same problem and read the same documentations. Did you found a solution now?

Kind regards
Andreas

Accepted Solutions (0)

Answers (2)

Answers (2)

Andreas_M
Explorer
0 Kudos

Hey together, I tried a lot to get it working with field change. I debugged into Fiori Elements code and in my opinion the target value help entity got only an update with action as source. Maybe @david_kunz2 or @Andre_Fischer you can link me to Fiori Elements team which can confirm that its only working for actions as source or they can provide an example for XML Annotations?

Thanks & Best regards
Andreas

marcel_waechter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sebastian,

this should also work with SideEffects annotated on field changes.

To test the same I changed the example in the FPM explorer in the following way:

annotate RootEntity with @(

  UI.Facets #BusinessPartnerAddress  : [{

    $Type : 'UI.ReferenceFacet',

    Target: 'businessPartner/@UI.FieldGroup#BusinessPartnerAddress'

  }],

  Common.SideEffects #BusinessPartner: {

    SourceProperties: [BusinessPartnerID],

    TargetEntities  : ['/sap.fe.core.Service.EntityContainer/BusinessPartnerAddress']

  }

)

Although this example does not make many sense, whenever I changed the business partner the value help of the business partner was invalidated (= read again). 

Your example looks actually good. Which UI5 version do you use? 

Best regards,
Marcel