Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

How to capture timestamp when user Dynamics365 form onunload or closure event

(0) ShareShare
ReportReport
Posted on by 5

How to capture the timestamp when user closes the form in dynamics 365 CE

I have tried window.onbeforeunload and formcontet.onunload and addeventlistener.nothing is working as expected.

  • slx Profile Picture
    slx 386 on at
    RE: How to capture timestamp when user Dynamics365 form onunload or closure event

    D365 contact audit history shows a line 'timstamp of form submission'

    I cannot find any field with this name - where is the audit history shows this ?

    How can I trigger this field ?

    thank you

  • Suggested answer
    RajarajanS Profile Picture
    RajarajanS on at
    RE: How to capture timestamp when user Dynamics365 form onunload or closure event

    Hello, 

    As far as form closing goes, I don't think there is an event to capture the form close. 

    You can programattically close the form and then capture that timestamp. To close the form you can use https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/close.

    As a workaround, you can add a setsumbitmode function to any field on the form and set the mode to always. If the user saves the form before closing it each time, then the set submit mode for the field will capture in audit history irrespective of the field being dirty or not. You just have to ensure the user does a save before form close. 

    Hope this helps.

    Best regards,

    Raj

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans