web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Disable/Hide Business Process flow Set Active or Next stage button

(0) ShareShare
ReportReport
Posted on by 1,235

Hi All,

I have a requirement to validate the current user whether is authorize to move to next stage of in my custom business process flow. How can I disable it by using javascript?

I had checked seem business rule cannot achieved this requirement.

Thanks.

Regards,
Teh

I have the same question (0)
  • Suggested answer
    Carlos Eduardo Fontolan Profile Picture
    on at

    Hi Ya Teh,

    Maybe could you check some user information using - var userSettings = Xrm.Utility.getGlobalContext().userSettings - Reference: docs.microsoft.com/.../usersettings

    Using this sample you can validate UserID, SecurityRoles or some other information to validate the current user.

    After it, based on validation is possible to apply setVisible on Business Process Flow using docs.microsoft.com/.../formcontext-ui-process.

    Another possibility is to use synchronous workflow to come back based on some validation, in this situation, the customer can change but system will revert it.

    Let me know if the information above is valid for your scenario.

  • Venedict Profile Picture
    1,235 on at

    Hi Carlos,

    I did tried using formContext.ui.process however, this function seem is hide the whole business process flow control.

    What I want is to hide the button of each stage based on user validation.

    stage-button.jpg

    I can't any reference related to the Next stage button.

    Thanks.

    Regards,
    Teh

  • Suggested answer
    Carlos Eduardo Fontolan Profile Picture
    on at

    Hi Teh,

    Maybe you can't remove this button using a supported method, I need to research more about it.

    It's possible to use two ways to 'prevent' the customer move:

    a. On security role, if you uncheck to write on permission on business process flow.

       - In this scenario when the system user try to move, will receive an error message, based on permission insufficient.  

    b. Use a javascript funcion moveprevious based on this reference docs.microsoft.com/.../moveprevious.

     - In this scenario is need to use the function addonstagechange to check some changes on stage and moveprevious. To check addonstagechange, you could check this reference docs.microsoft.com/.../addonstagechange.

    Let me know if these information help you.

  • yassin sayed Profile Picture
    85 on at

    function HideSetAcgtiveButton(executionContext) {

       var formContext = executionContext.getFormContext();

       formContext.data.process.addOnStageSelected(onStageClicked);

    }

    function onStageClicked(executionContext) {

       var formContext = executionContext.getFormContext();

    var hide = true;

    var interval = null;

    interval = setInterval(function () {

           var element = parent.document.getElementById("MscrmControls.Containers.ProcessStageControl-businessProcessFlowFlyoutFooterContainer");

           if (element != null && hide == true) {

               hide = false;

               element.style.display = "none";

               clearInterval(interval);

           }

       }, 10);

    }

  • yassin sayed Profile Picture
    85 on at

    function HideSetAcgtiveButton(executionContext) {

       var formContext = executionContext.getFormContext();

       formContext.data.process.addOnStageSelected(onStageClicked);

    }

    function onStageClicked(executionContext) {

       var formContext = executionContext.getFormContext();

    var hide = true;

    var interval = null;

    interval = setInterval(function () {

           var element = parent.document.getElementById("MscrmControls.Containers.ProcessStageControl-businessProcessFlowFlyoutFooterContainer");

           if (element != null && hide == true) {

               hide = false;

               element.style.display = "none";

               clearInterval(interval);

           }

       }, 10);

    }

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans