I have the javascript below, the weird thing is it just stopped working this morning. When I try to set the field "new_seconds", I always get a 0. I've declared a global variable so I should be able to pass paramteres between functions but I always get a 0. I don't know what went wrong this morning.
var i = 1; var MSeconds = 0; function onLoad() { _Timer(); } function _Timer () { setTimeout(function () { MSeconds = MSeconds + 1; alert(MSeconds); i++; if (i > 0) { _Timer(); } }, 1000) } function onSave() { Xrm.Page.data.entity.attributes.get("new_seconds").setValue(MSeconds); }
Anyone know how to fix this?