​​Toggling the New button in Inline Lookups in Dynamics 365​

Jared Johnson, 03 April 2020

Recently on a comment on one of my blog posts, I was asked why some lookups did not have a new record button while other lookups to the same entity did. An example is the Primary Customer lookup on case, it only allows selecting existing Contacts.

This setting is controlled by the IsInlineNewEnabled property in the Form XML. Setting this to false will disable the New button. Please note that this can be considered as an unsupported customization by Microsoft.

We will use the Primary Contact lookup on the Account form to test this out, by default the lookup has the New button.

Looking at the Form XML using the Form Xml Manager plugin for XrmToolBox, by default the parameters look like this:

<control id="primarycontactid" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="primarycontactid" disabled="false"> 
                      <parameters> 
                        <FilterRelationshipName>contact_customer_accounts</FilterRelationshipName> 
                        <DependentAttributeName>contact.parentcustomerid</DependentAttributeName> 
                        <DependentAttributeType>account</DependentAttributeType> 
                        <AllowFilterOff>true</AllowFilterOff> 
                        <AutoResolve>true</AutoResolve> 
                        <DisableMru>false</DisableMru> 
                        <DisableQuickFind>false</DisableQuickFind> 
                        <DisableViewPicker>false</DisableViewPicker> 
                        <DefaultViewId>{A2D479C5-53E3-4C69-ADDD-802327E67A0D}</DefaultViewId>        
                      </parameters> 
                    </control> 


Now if we add the IslineNewEnabled property as false:

<control id="primarycontactid" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="primarycontactid" disabled="false"> 
                      <parameters> 
                        <FilterRelationshipName>contact_customer_accounts</FilterRelationshipName> 
                        <DependentAttributeName>contact.parentcustomerid</DependentAttributeName> 
                        <DependentAttributeType>account</DependentAttributeType> 
                        <AllowFilterOff>true</AllowFilterOff> 
                        <AutoResolve>true</AutoResolve> 
                        <DisableMru>false</DisableMru> 
                        <DisableQuickFind>false</DisableQuickFind> 
                        <DisableViewPicker>false</DisableViewPicker> 
                        <DefaultViewId>{A2D479C5-53E3-4C69-ADDD-802327E67A0D}</DefaultViewId> 
                        <IsInlineNewEnabled>false</IsInlineNewEnabled> 
                      </parameters> 
                    </control> 


The New button is now gone.

Setting it to true or removing it will bring back the new button.