web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

I have the same question (0)
  • Community Member Profile Picture
    on at
    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

  • TheMarkChristie Profile Picture
    10,328 Moderator 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"

  • Verified answer
    awalters Profile Picture
    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.

  • Verified answer
    ashlega Profile Picture
    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

  • awalters Profile Picture
    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!

  • awalters Profile Picture
    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

       }

     );

    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans