Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to enable auto save on a form

Posted on by 2,645

By default I have auto save turned off at the organization level.  However, I have one form where I want it turned of for.  I have seen the javascript that shows how to turn it off, but not on.  Does anyone know how to turn it on for a certain form?  I have a workflow kicking off and then a business rule also kicks off.  The business rule is what is causing the unsaved changes.  I don't want to have the user to open the record up and click save.  So I was wondering if there was something that I can put in via JavaScript that would just save the form automatically without having to open it.

Thank you in advance.

*This post is locked for comments

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to enable auto save on a form

    Thank you guys...I was able to get this working, by taking the business rules out and putting them in a workflow.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: How to enable auto save on a form

    Hi,

    I agreed with  Alex , try to set the scope of business rules Entity .

    Second you can not fire onchange event when field set using business rules so you can put the condition not to set the value if you dont need.

    You can not enable autosave for particular entity out of the box , so you can write the complete business rues  logic using JS and when you set the value fire Xrm.Page.data.entity.save() .

    If you still want to use the business rules then you can try with below code registering method in the onload of the forms , it will save data every certain interval but make sure  this is not a good practice.

    function AutoSaveForm() {
        if (Xrm.Page.ui.getFormType() == 2) { // will fire only for update record
            var intervalId = window.setInterval(
             function () {
                 window.clearInterval(intervalId);
                 Xrm.Page.data.entity.save()
             }, 3000); // Data will save every 2 seconds
        }
    }
  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to enable auto save on a form

    Hi,

    The unsaved changes occurs if the values is changed. If you know that business rule is changing the value then why don't you put aditional check to only update the field if the value is not there or not same.?

    Hope this helps.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: How to enable auto save on a form

    Hi,

    since business rule is the one who causing the unsaved changes. Why dont you set the business rule scope to entity mode.

    www.inogic.com/.../business-rule-updates-in-dynamics-crm-2015

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans