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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Restrict role's access...
Power Apps
Answered

Restrict role's access to next stage button in BPF?

(0) ShareShare
ReportReport
Posted on by 122

What's the proper way, if any, to make my BPF such that all roles can see the stages but very few, if any, can actually move the stages?  I have most of it automated right now.

 

I have the same question (0)
  • Verified answer
    Jonathan Manrique Profile Picture
    2,687 on at

    Hi @mhomol 

     

    To restrict moving stages you must do it through javascript, you must consult the user's role and from there define whether or not you restrict the advancement of the stage.

     

    I will give you the example js, you must put together the logic based on your requirement

     

    function bloquearEtapa() {
     var etapa = formcontex.data.process.getActiveStage();
     etapa.setLocked(true);
    }

     

    Another way to do the same is to consult the user's security role and create a control field within the steps of the stage that is required and is only filled out if the role is equal to a value, only this can be difficult to control.

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    You can accept more than one post as a solution

  • mhomol Profile Picture
    122 on at

    @Jmanriquerios , I am not seeing a setLocked function.  Can you point me to the API definition of this?

  • Jonathan Manrique Profile Picture
    2,687 on at

    OnStageChange Event (Client API reference) in model-driven apps - Power Apps | Microsoft Learn

    function bloquearAvanceDeEtapa(executionContext) {
     
     var formContext = executionContext.getFormContext();
     var processControl = formContext.ui.process;
    
     
     processControl.addOnStageChange(function (eventArgs) {
     
     var currentStage = eventArgs.getStage();
    
     
     if (currentStage.getName() === "NameStage") {
     if (bpfArgs.getDirection() === "Next") { // only next stage movement is allowed. You can stop it depending on custom business logic as well
     // stop the stage movement
     bpfArgs.preventDefault();
     alertStrings = { confirmButtonLabel: "OK", text: "Next stage movement is not allowed", title: "Sample title" };
     alertOptions = { height: 120, width: 260 };
     Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);
     return;
    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard