Remove or Hide Business Process Buttons


To Hide the Business Process Buttons cannot be done OOB.

To achieve this add a HTML Web Resource on Form and paste the following code. See the magic. 🙂

HTML Web Resource:

$(document).ready(function () {

// Hide Next Stage button

if (!parent.document.getElementById(“stageNavigateActionContainer”).classList.contains(“hidden”)) {                        parent.document.getElementById(“stageNavigateActionContainer”).classList.add(“hidden”);

}

// Hide Next Stage button

if (!parent.document.getElementById(“stageAdvanceActionContainer”).classList.contains(“hidden”)) {

parent.document.getElementById(“stageAdvanceActionContainer”).classList.add(“hidden”);

}

// Hide Previous Stage button

if (!parent.document.getElementById(“stageBackActionContainer”).classList.contains(“hidden”)) {

parent.document.getElementById(“stageBackActionContainer”).classList.add(“hidden”);

}

});

If you want to Hide the Complete Actions like “Set Active” then instead of specifying the what buttons to hide use below code to Hide all buttons related Business Process.

if (!parent.document.getElementById(“processActionsContainer”).classList.contains(“hidden”)) {

parent.document.getElementById(“processActionsContainer”).classList.add(“hidden”);

}

Still when you click on Stages, it will again show the buttons. To fix that on Form load attach the events Stage Selected and Stage Change to the Business Process.

function OnLoad()

{

Xrm.Page.data.process.addOnStageSelected(RefereshHTML);

Xrm.Page.data.process.addOnStageChange(RefereshHTML);

}

//To Refresh the HTML Web Resource on Form.

function RefereshHTML()

{

var webRControl = Xrm.Page.ui.controls.get(<WebResourceName>);

var webResource = webRControl.getSrc();

var position = webResource.lastIndexOf(‘?’);

if (position!= -1)

webResource = webResource.substring(0, position);

else

webResource = webResource + “?”;

webRControl.setSrc(webResource);

}

 

About Kishore Dhanekula

MS Dynamics CRM and .NET Architect
This entry was posted in CRM, HTML, Java Script, JavaScript, MS Dynamics CRM 2015, MS Dynamics CRM 2016 and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s