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

Timmer Function is not properly working.When we save the record the record. speed of timmer is going fast.

$
0
0
Hi All,
When I create a new Account Record the timmer will be running with 0 and when the user will have save the record the timmer will by running very fast ..
please suggest me best Approach.
var seconds = 0, minutes = 0, hours = 0,t;
var isDirtyForm = false;
function add() 
{
isDirtyForm = Xrm.Page.data.entity.getIsDirty();
var flag = Xrm.Page.getAttribute("new_timerstatus").getValue();
if(isDirtyForm===true)
{
if (flag == "1")
{
seconds++;
    if (seconds >= 60) {
        seconds = 0;
        minutes++;
        if (minutes >= 60) {
            minutes = 0;
            hours++;
        }
    }
}
    
//creating time value in hh:mm:ss formate
    var tmp = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds);
Xrm.Page.getAttribute("new_timer").setValue(tmp);
    
}
//recursively calling timer
timer();
    
}
//main timer method
function timer() {
    t = setTimeout(add, 1000);
}
function onLoad()
{
Xrm.Page.getAttribute("new_timerstatus").setValue("1");
}
Thanks & Reagrds 
Rahul Gattani 

Viewing all articles
Browse latest Browse all 79901

Trending Articles



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