Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to indicate that workflow is in progress after button click?

(0) ShareShare
ReportReport
Posted on by 3,079

I've used Ribbon Workbench to create a button that calls custom javascript (using process.js) that saves the record, runs a couple of workflows, pops up a message with the result, and then refreshes the page.  This all works fine.  However, in the second or two it takes to run the workflow, there is no indication that the button was successfully pressed or that anything is happening.  Is there any way to pop up an indicator, grey out the main window, etc...something to show that the button has been pressed and the function is in progress?  Basically something to lock the page and take focus until the function finishes.

*This post is locked for comments

  • awalters Profile Picture
    awalters 3,079 on at
    RE: How to indicate that workflow is in progress after button click?

    I did end up going with alert.js, btw - thanks again!  Basically my button js looks like this, for reference of anyone else wanting something like this:

    function btnRunAction(recordId) {

     url = <our base url>;

     //using action instead of workflow so we can piece together a combined return message about what's getting accomplished at each step

     var action = "<name of action to run";

    //forcing save first, on success show the alert and run the action

     Xrm.Page.data.save().then(

       function () {

       Alert.show("Finalizing...", null, [], "LOADING", 400, 200, url, true);

          Process.callAction(action,

    [{

    key: "Target",

    type: Process.Type.EntityReference,

    value: new Process.EntityReference(<entity>, recordId)

    }],

    function (params) {

    var messageSuccess = "";

    messageSuccess = params["successOutput"].replace(/\./g,'.<br/>');

    Alert.show("Success", messageSuccess, null, "SUCCESS", 400, 200, url, true);

       Xrm.Page.ui.close();

    },

    function (messageFail, trace) {        

    Alert.show("Error", messageFail, null, "ERROR", 400, 200, url, true);

    Xrm.Page.ui.reload();

    }, url);

       },

       function() {

        //do nothing on save failure since CRM will give its own messaging about why the save failed

       }

     );

    }

  • awalters Profile Picture
    awalters 3,079 on at
    RE: How to indicate that workflow is in progress after button click?

    Ooooh, that looks like it would work quite well.  I might play with that just in case I'd rather replace the notification, and/or for future use.  Thanks!

  • Verified answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: How to indicate that workflow is in progress after button click?

    Hi,

     btw, you might try using alert js:

    alertjs.codeplex.com/documentation

  • Verified answer
    awalters Profile Picture
    awalters 3,079 on at
    RE: How to indicate that workflow is in progress after button click?

    It's possible those would work, though I did end up finding another way.  It doesn't lock them out, but that's not a big deal - it was mainly about letting them know something was happening without making them click to close a popup.  Ended up using "Xrm.Page.ui.setFormNotification" at the start of the function to give a message as to what was happening, and "Xrm.Page.ui.clearFormNotification" at the end to clear it away.  Dead simple, and works for the purpose of just a clear visual indicator that things are happening.  If I had to lock it out then I probably would've had to go to web resources and whatnot, but this was so quick!  :-)

    Also, wasn't sure if I called a web resource, how I would make it go away at the end.  Would it be a reload of the page I'd been on previously?  (Just for future reference of anyone checking this out in future.)  Seems like it's more overhead than I'd like that way, but I'm not sure how else to do it.

  • TheMarkChristie Profile Picture
    TheMarkChristie 10,328 on at
    RE: How to indicate that workflow is in progress after button click?

    Hi Alison,

    You can add code into your JS at the end that calls an HTML page stating "For Your Information The Background process have started"

  • RE: How to indicate that workflow is in progress after button click?

    Hello Allison .. I've seen this problem before, in one of our CRM clients, and the users clicks continuously that button beacuse they have not visual response.. Can you call a WebResource with the RibbonWorkbench?

    If yes, you can show a simple html code to gives them a "hope", something like the "Loading application, please wait" message, that's appear when we log in into a CRM.

    Best Regards

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans