Change the list of records users can create via the top command bar Plus Sign on Dynamics CRM 365
Introduction
We have a situation where users are only allowed to create opportunities by qualifying leads. While we've removed the "New" button using Ribbon Workbench, some users are still accessing the Fast Create option from the top navigation in Dynamics 365.
Solution
There isn't a direct solution to remove items from the Quick Create top navigation bar in CRM 365. As a workaround, I implemented a JavaScript function that triggers an alert when the Quick Create form loads, prompting the user and then closing the form.
function displayAlertDialogTextOperationNotAllowed()
{
var lookupField = Xrm.Page.getAttribute("originatingleadid");
if (lookupField != null && lookupField.getValue() == null)
{
Xrm.Page.ui.controls.forEach(function (control, i)
{
control.setDisabled(true);
control.setVisible(false);
});
var alertStrings = {
confirmButtonLabel: "OK",
title: "Operation not allowed",
text: "Please create the Opportunity from lead."
};
var alertOptions = { height: 200, width: 300 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function (success)
{
Xrm.Page.ui.close();
},
function (error)
{
console.log(error.message);
}
);
}
}
The result after the user clicks on Quick Create Opportunity will appear as shown in the snapshot below.