Save and Close not working on the forms in Dynamics 365 CE

Hi Everyone,

Today I was working with HTML Webresource, we have some Hyperlinks on that. We have observed a
very strange issue, Save and Close button on the from is not working on first click after we click on the hyperlink in the HTML Webresource and it works when we click for second time.

Here is the sample source code that we had and if we remove the HTML webresource or if don’t click on the hyperlinks every thing is working fine. We were sure that there is something in HTML that is creating the issue.

<!DOCTYPE html>

<html lang="en" xmlns="">
    <meta charset="utf-8" />
    <script src=""></script>
    <script type="text/javascript">

        function onSomeLinkClick() {

        $(document).ready(function () {


        <a id="SomeLink" onclick="onSomeLinkClick()" href="#" title="Some Link">Some Link</a>

    <div>I am HTML Page</div>


After checking the code slowly, we found that in href properyy # was given and that was causing this issue. As the hyperlinks has # in href, when we click the link, it is pushing the current URL to browser’s history stack and due to that we must click “Save and Close” 2 times to go back to list page. Technically Save and Close button just does “Save” and do “history back”.

Removing # from href property of Anchor tag resolved the issue.

<a id="SomeLink" onclick="onSomeLinkClick()" href="" title="Some Link">Some Link</a>

Hope this helps.

Happy 365’ing

2 thoughts on “Save and Close not working on the forms in Dynamics 365 CE

  1. pvraghukumar June 2, 2020 / 11:00 am

    Thanks for this post, I wasn’t aware of the SaveandClose functionality being navigated to previous page from browsing history.


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