Refreshing a parent window when crmForm.IsDirty


When you try to refresh the parent window from an ISV page and the crmForm was
modified but not saved, you will get a confirmation dialog from CRM asking you
to continue or cancel the action.

To disable this behaviour you can Save the CRM form before the refresh action.

This seems to be standard CRM behaviour. You can try this when modifying an
account and then deactivating it. The new values will be saved automatically and
the account will be deactivated.

Put the following code in the OnInit of the aspx page:

protected override void OnInit(EventArgs e)
{
// Check if the crmForm was modified.
Response.Write(“<script>” + “\n”);
Response.Write(“if (window.dialogArguments.document.crmForm.IsDirty == true)” + “\n”);
Response.Write(“{“ + “\n”);

Response.Write( window.dialogArguments.crmForm.Save();” + “\n”);
Response.Write(“}” + “\n”);
Response.Write(“</script>;”);

base.OnInit(e);
}

Regards,

Kenny

Advertisements
Tagged with: , ,
Posted in CRM 4
2 comments on “Refreshing a parent window when crmForm.IsDirty
  1. Bryan says:

    Could you provide the code to refresh the parent please?

  2. Anja says:

    When someone writes an paragraph he/she keeps the thought of a user in
    his/her mind that how a user can know it.
    Therefore that’s why this piece of writing is great. Thanks!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: