cancel
Showing results for 
Search instead for 
Did you mean: 

Event Handler for SAP CAP Draft Lock Expiration?

huijiezhang
Product and Topic Expert
Product and Topic Expert
0 Kudos
143

With SAP CAP, is it possible to register an event handler for Draft Lock timeout?

Our requirement is that when a draft lock expires, we want to automatically move the draft data to persistent storage (auto-save) and notify user that the draft data is saved automatically and lock is released.

Thank you

View Entire Topic
catano
Active Participant

Hi @huijiezhang ,

By checking all events in debug, it seems that there is no built-in event for draft lock expiration.
Also, no notification has been sent to the UI after the lock expires.

The framework checks for existing lock when a user tries to edit a record.
Mimicking that, I can imagine a polling mechanism set up to run at regular interval to check lock expiry by comparing DRAFT_DraftAdministrativeData.LastChangeDateTime + cds.fiori.draft_lock_timeout to now.

If you mean to send back notification to the UI from the server tied to the session where the user is editing the draft, that could be tricky. Currently I have no idea if the framework provides a utility to do that.

Regards,
Peter

huijiezhang
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thank you very much Catano. Appreciate you spending the time looking into the package. Your answer confirms our understanding.