SAP Knowledge Base Article - Public

3090030 - OnDelete is Not Executed when Deleting a Territory

Symptom

You have a custom OnDelete event implemented in your custom solution and you notice that it is not executed when deleting a sub-territory from the standard Territory screen.

Environment

  • SAP SAP Cloud for Customer 
  • SAP Cloud Applications Studio 

Reproducing the Issue

1. Go to Sales Work Center
2. Go to Territories view
3. Search for Territory ABC
4. Select it and click on the option New SubTerritory
5. Create a dummy new SubTerritory
6. Go back to the Territories OWL and search for ABC again -> you will see that the new SubTerritory you created will be shown under ABC
7. Select the new SubTerritory you created and click on Delete button
8. You will see that your event OnDelete is not executed


Cause

This issue happens because there is no physical deletion of territories once they are removed from Territory Hierarchy.
Instead, an Update on the to be deleted Territory occurs where element DeletedIndicator is set to true. Those are then filtered out in UI and are no longer shown.


Resolution

In this case, the best way forward would be to handle the onDelete logic in an Event BeforeSave script in the same node you tried implementing the OnDelete.

Keywords

 OnDelete; Territory; SDK; ABSL;PDI , KBA , AP-RC-BDS-BO , ByDesign Studio BO definition/generation , Known Error

Product

SAP Cloud for Customer add-ins all versions