Firing on-load event every time when record is saved. Exploring the data onload event in Dynamics v9.0

Recently I was working with a customer and came across a requirement where they needed to fire an event on client side every time once the data is saved successfully to process some post-save operations.

As we all know from version CRM 2013 and onwards the formload event does not fire when save is completed. So what is the other way around?

Well there is way to do that. We need to use the to add an event which fires every time when the data is refreshed.

The below code adds the onLoad event of data refresh in the form load event of the account entity.

function formLoad(e) {
    var formContext = e.getFormContext();;

    console.log("form load called.");

function dataOnLoad(e) {
    // write your code here.
    console.log("data onload fired");

formLoad is the event which is registered through Form events. In the formload we are adding the event for data refresh using the method.

The function dataOnLaod fires on the initial page load as well as every time the user clicks on save. And now you have a way to perform your post-save operations in client side whenever the record is saved.

Also please note that the function also fires if function is called.

Debajit Dutta
(Dynamics MVP)
For consultation/ training visit or reach out to us at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s