I have a scenario in Quote form, where when the record is on a status, to display a Progress Indicator, but when status changes (from another procedure), this indicator must close.
function showIndicator(executionContext){
var formContext = executionContext.getFormContext();
var status = formContext.getAttribute('statuscode').getValue();
var message = 'Quote is being processing'
if(status == 493430001){
Xrm.Utility.showProgressIndicator(message);
setTimeout(function () {
//Refresh Form
formContext.data.refresh(false);
});
}, 3000);
}else{
Xrm.Utility.closeProgressIndicator();
}
}
This function executes on load of the page. I want to refresh page after 3sec and check again the status of the record, if it's still processing, to display the message, and then again refresh after 3sec
Instead of setTimeout, use setInterval
function showIndicator(executionContext){
var formContext = executionContext.getFormContext();
var status = formContext.getAttribute('statuscode').getValue();
var message = 'Quote is being processing'
if(status == 493430001){
Xrm.Utility.showProgressIndicator(message);
setInterval(function () {
showIndicator(executionContext);
}, 3000);
}else{
Xrm.Utility.closeProgressIndicator();
}
}