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

Notifications

Announcements

Community site session details

Community site session details

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard