PhuocLe - Microsoft Dynamics CRM

Hide Next Stage, Set Active, Back Button in Business Process Flows Aug/16/2016


I have a requirement in my current project that hide Next Stage, SetActive and Back button in the Business Process Flows

To do that, I used an unsupported code below.

function hideBPFButton() {
    hideBPFButtons();
    window.addEventListener("resize", hideBPFButtons);
    Xrm.Page.data.process.addOnStageSelected(hideBPFButtons);
}

function hideBPFButtons() {
    var dom = (Xrm == undefined || Xrm.Internal == undefined || Xrm.Internal.isTurboForm() == undefined || Xrm.Internal.isTurboForm() == false) ? document : parent.document;
    $("#stageSetActiveActionContainer", dom).remove();
    $("#stageBackActionContainer", dom).remove();
    $("#stageNavigateActionContainer", dom).remove();
    setTimeout(function () { $("#processStagesContainer", dom).width(1894); }, 50);
}

In the form OnLoad, call function

hideBPFButton();

Before apply code

 

After apply code

 

 

How to program change stage, set active, ....

  • Client side: check Xrm.Page.data.process and Xrm.Page.ui.process
  • Server side: reference 3 fields in the entity record, update these fields and update entity record.
    • processid
      • query processid by Process Name in entity workflow
        
          
            
            
              
              
              
            
          
        
    • stageid
      • query stageid by processid and Stage Name in entity processstage
        
          
            
            
              
              
            
          
        
    • traversedpath
      • combine entity id string. Eg. in this case leadid,opportunityid,quoteid,salesorderid (seperator use comma)

Checked, Tested work with CRM2016, CRM2016 SP1, CRM2016 Online

Unsupported code, use it with your own risk.


Category: CRM
Johann Quintero avatar Johann Quintero
wrote: Aug/29/2016

Thanks for sharing... this is a nice way to handle it.

But there is something that is failing with this, when you resize... the buttons are show again, and i do not know why.

By the way, do you know a way to set read only all the fields inside the BPF?

Thanks.

Johann Quintero.

wrote: Jun/13/2017

Thanks for sharing... this is a nice way to handle it.

But is there any way to hide 'Active Stage Flag'. Thanks in advance.

Enter your comment

Your Name (*)
Your Email (*)
Website (*)

Search

About Me

Connect

Projects

Categories

MB2

Tags

RSS