Hide +New Record button in Dynamics 365 lookup Field



In Dynamics 365 Lookup DataType Attribute +New Record Button visible by default when User has Create privileges.



  •     If we want to hide the +New Record Button We are able to do that using JavaScript.
  •     I am providing code for that at the end of this blog and you can check it.   

 Above script

1)     lookUpLogicalName variable value is used as  “parentcustomerid” you can replace this with your lookup Attribute LogicalName.

2)     If you want to Hide +New Record Button IsInlineNewEnabled should be "false"

Below line is syntax:

lookupAttributeControl.controlDescriptor.Parameters.IsInlineNewEnabled="false";  

If you want to show that again +New Record Button IsInlineNewEnabled should be "true"

Below line is syntax:

lookupAttributeControl.controlDescriptor.Parameters.IsInlineNewEnabled="true";  

After following steps 1 and 2, Open that Entity Form and Developer tools 


              Paste the given code in Console and press Enter now you can check +New Record button is 
              Hidden. 
              (Check highlighted part in Image)

            Again  if you want to show that +New Record Button

            (Check highlighted part in Image)



Below is the JavaScript code for hiding +New Record Button 

Add this code in to your .js file and update into CRM. 

Register function Onload Event for that respective Form and Pass the executionContext as parameter

 



Comments

Popular posts from this blog

Hide New Button In Lookup Field In Microsoft Dynamics 365 Using Javascript