Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Answered

Progress Indicator bar stopped working

Posted on by 235

Hello CS Experts,

I have placed a custom button on contact form. This button sets a value to a field date. The code include a call to Progress Indicator API. It was working before then for an unknown reason it just stopped functioning.

All other parts of the code are working perfectly except the progress indicator.

Below is my javascript code:

//function to set GDPR Deletion date
function setDeletionDate(executionContext){
    var formContext = executionContext;
    var notificationTime=3000;
   
    if (formContext.ui.getFormType() == 2)
    {    
       
        var prevDate = formContext.getAttribute("ava_gdprdeletiondate").getValue();
        var confirmStrings = {title: "Confirm GDPR Revocation" , text: "Are you sure to revoke GDPR                                                  Consent?"}
        var confirmOptions = {width: 450, height: 200};
        Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
            function (success) {
              if (success.confirmed) {
               
                var delDate = new Date();
                formContext.getAttribute("ava_gdprdeletiondate").setValue(delDate);
                formContext.data.refresh(save).then(successCallback, errorCallback);
                
                Xrm.Utility.showProgressIndicator("Revoking GDPR consent....");
     
                setTimeout(
                function () {
                Xrm.Utility.closeProgressIndicator();
                },
                notificationTime
            );
               
                         
              } else {
                formContext.getAttribute("ava_gdprdeletiondate").setValue(prevDate);
            }
            });
       

       

    }
   
}
Can somebody from the community help me point out where the code is not working. I already used Javascript validator from XRMtoolbox and it did not show any error.
Regards,
Jolas365
  • Jolas365 Profile Picture
    Jolas365 235 on at
    RE: Progress Indicator bar stopped working

    Hello Steve Zhao2 ,

    Thank you very much!

    Regards,

    Jorge

  • Verified answer
    Steve Zhao2 Profile Picture
    Steve Zhao2 on at
    RE: Progress Indicator bar stopped working

    Hi Jolas365,

    The parameter save should be a Boolean value in this line formContext.data.refresh(save).then(successCallback, errorCallback);

    So please declare the save variable before.

    function setDeletionDate(executionContext){
        var formContext = executionContext;
        var notificationTime=3000;
        var save = true;
       
        if (formContext.ui.getFormType() == 2)
        {    
           
            var prevDate = formContext.getAttribute("ava_gdprdeletiondate").getValue();
            var confirmStrings = {title: "Confirm GDPR Revocation" , text: "Are you sure to revoke GDPR                                                  Consent?"}
            var confirmOptions = {width: 450, height: 200};
            Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
                function (success) {
                  if (success.confirmed) {
                   
                    var delDate = new Date();
                    formContext.getAttribute("ava_gdprdeletiondate").setValue(delDate);
                    formContext.data.refresh(save);
                    
                    Xrm.Utility.showProgressIndicator("Revoking GDPR consent....");
         
                    setTimeout(
                    function () {
                    Xrm.Utility.closeProgressIndicator();
                    },
                    notificationTime
                );
                   
                             
                  } else {
                    formContext.getAttribute("ava_gdprdeletiondate").setValue(prevDate);
                }
                });
        }
    }

    Reference:

    data.refresh (Client API reference) in model-driven apps - Power Apps | Microsoft Learn

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans