show progress when click button Dynamics CRM 365

admin

Administrator
Staff member
I have a ribbon button to execute custom workflow. this action a setup from JavaScript and it worked perfectly. In this case I wanna show progress loading when after click or during custom workflow execution.

I just followed the tutorial <strong><a href="https://mahenderpal.wordpress.com/2...essage-during-function-execution-in-crm-form/" rel="nofollow noreferrer">HERE</a></strong>. this my javascript function code:

Code:
function showLoadingMessage() {
    try{
        tdAreas.style.display = 'none';
        var newdiv = document.createElement('div');
        newdiv.setAttribute('id', "msgDiv");
        newdiv.valign = "middle";
        newdiv.align = "center";
        var divInnerHTML = "&lt;table height='100%' width='100%' style='cursor:wait'&gt;";
        divInnerHTML += "&lt;tr&gt;";
        divInnerHTML += "&lt;td valign='middle' align='center'&gt;";
        divInnerHTML += "&lt;img alt='' src='/_imgs/AdvFind/progress.gif'/&gt;";
        divInnerHTML += "&lt;div/&gt;&lt;b&gt;Working…&lt;/b&gt;";
        divInnerHTML += "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
        newdiv.innerHTML = divInnerHTML;
        newdiv.style.background = '#FFFFFF';
        newdiv.style.fontSize = "15px";
        newdiv.style.zIndex = "1010";
        newdiv.style.width = document.body.clientWidth;
        newdiv.style.height = document.body.clientHeight;
        newdiv.style.position = 'absolute';
        document.body.insertBefore(newdiv, document.body.firstChild);
        document.all.msgDiv.style.visibility = 'visible';
    }
    catch(ex){
        alert(ex.message);
    }  
}

and this one is to hide progress:

Code:
function hideLoadingMessage(){
    document.all.msgDiv.style.visibility = 'hidden';
}

this is the function that I called in my ribbon button action for testing loading progress work or not:

Code:
function ribbonButton()
{
    var guid = Xrm.Page.data.entity.getId();
    if (guid != null)
    {
        showLoadingMessage(); //show progress

        /*var workflowId = '04E84379-87E4-E711-814E-000C294D2FF8';
        var workflowName = 'CloneReward';
        ExecuteWorkflow(workflowId, workflowName, function ()
        {
            RefreshForm();
        });*/

        //hideLoadingMessage(); //hide progress
    }
}

when I pressed the button I get the following error message:

<a href=" " rel="nofollow noreferrer"><img src=" " alt="enter image description here"></a>

Need any suggestions. Thanks.