Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Enabling Auto-Save in a JS code

$
0
0

Hello, 

I have a JS code which runs on Account form onLoad and rollup field onChange - and copies the value from a rollup field to a temp field. I am using that temp field as a trigger in my workflow to set the account status accordingly. 

However, I have noticed that whenever the system updates the rollup field, it does copy over to the temp field fine, BUT does not trigger the workflow since the form does not save after the temp field updates. I added lines of code to autosave. But it is not working as expected. Note that I do have auto-save turned on in System Settings, but the save does not trigger when the temp field populates. 

function new_openopp ()
{
  var formOP = Xrm.Page.getAttribute("opendeals").getValue();
  Xrm.Page.getAttribute("openopportunitiestemp").setValue(formOP);

function AutoSaveForm() {
    if (Xrm.Page.ui.getFormType() == 2) { //only for form update
        var intervalId = window.setInterval(
         function () {
             window.clearInterval(intervalId);
             Xrm.Page.data.entity.save()
         }, 3000); 
    }
}}

Is there anything missing here? Would appreciate any help here. 

Thanks, 
Aneeqa


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>