2637194 - Event-AfterLoading Is Not Getting Triggered

SAP Knowledge Base Article - Public

2637194 - Event-AfterLoading Is Not Getting Triggered

Symptom

You have a custom solution with Event-AfterLoading added on a Extension BO's Node  (BO stands for Business Object), you access a view on frontend that has data of the Node that you added the event, but the event is not triggered.

E.g.: You have a Event-AfterLoading on Node Item of BO CustomerQuote. You open a CustomerQuote instance on frontend and click on tab Products. Tab Product have a list of Items that is related to the current CustomerQuote, but accessing this tab didn't trigger the Event-AfterLoading.

Environment

All Versions of SAP Hybris Cloud for Customer.

All Versions of SAP Business ByDesign.

Reproducing the Issue

  1. Login on SDK.
  2. Open a Solution YABC1234_ (YABC1234_ stands for the ID of your custom solution).
  3. Create a Extension BO.
  4. Create a Event-AfterLoading for one of the Nodes of the Extension BO.
  5. Login on frontend.
  6. Access the Work Center related to the Extension BO.
  7. Access a TI (TI stands for Things Inspector) View or Tab or EC (EC stands for Embedded Component) that use data of the Node that you created the Event-AfterLoading, but the event was not triggered.

Cause

The Event-AfterLoading is a event that will be only triggered when a instance of the Node is loaded on frontend. This means that only if the whole instance of the Node is loaded, the event will be triggered. Other retrieved methods, like associations, direct access and field binding will only load specific element data and not the instance, so for this cases the event is not triggered.

E.g.: You have a Event-AfterLoading on Node Item of BO CustomerQuote. You open a CustomerQuote instance on frontend and click on tab Products where a list of Items that is related to the current CustomerQuote is maintained, but event After-Loading was not triggered. The data on that List is just a reference to some data of some elements of Node Item. The event will only trigger if you click on the Item and open its own View. Once the Item View is opened, system load the entire Node Item and then the Event-AfterLoading is trigger.

Resolution

Adapt your ABSL Script and Business Logic to consider that Event-AfterLoading will only trigger when the whole instance is loaded and that any kind of retrieve, association or bound data performed on the View will not trigger the event.

Keywords

ABSL; Script; Event; AfterLoading; Extension; BO; Node; Trigger; , KBA , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , How To

Product

SAP Business ByDesign all versions ; SAP Hybris Cloud for Customer all versions