A bug exists in CRM 2015 SP1 that prevents users from modifying the root Business Unit because the parent Business Unit is required but it has no value. In today’s blog, we will go over the steps needed to work around this issue. Let’s begin!
In this example CRM organization, we have two Business Units; bigmonkeymanufacturing is our root Business Unit and we have capuchingears set as a Business Unit under our root Business Unit, bigmonkeymanufacturing.
When we need to make a change to capuchingears, such as entering a main phone number for example, the change happens as it should with no problems.
If we try to make the same change to our base Business Unit, bigmonkeymanufacturing, you get an error message as shown below.
However, with this being our root Business Unit, there is no parent Business Unit. The steps to resolve this problem are as follows:
1. Create a JavaScript web resource file:
a. In CRM, go to Settings -> Customizations -> Web Resources.
b. Click on the New icon and name it ModifyParentBUField.
c. Set the type to Script (Jscript).
d. Click on the Text Editor and copy in the text below:
function ModifyParentBUcontrol()
{
var FORM_TYPE_CREATE = 1;
// get current TYPE and use it when u what it to run
var formType = Xrm.Page.ui.getFormType();
var ParentBUControl = Xrm.Page.getControl(“parentbusinessunitid”);
if (formType != FORM_TYPE_CREATE) {
if (ParentBUControl.getAttribute().getValue() == null)
{
ParentBUControl.setDisabled(true);
}
else
{
ParentBUControl.setDisabled(false);
}
}
}
e. Save the web resource.
2. Use the JavaScript web resource file on the Business Unit form.
a. Open the Business Unit form in design mode.
b. Click on Form Properties.
c. Add the new web resource exactly as shown in the following screenshot.
3. Save the form and Publish the changes.
You are now able to make the changes required to your root Business Unit!
That’s all for the blog today! Remember, you can get more handy tips and tricks like this one by subscribing to our blog!
Happy CRM’ing!