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

1)In below code replace "new_account" with your Lookup Attribute Logical Name.

2)Add HideNewButtonInLookupControl  javascript function in to your script and updated script file Into the CRM.

3)Register Onload Event For Form and Pass the executionContext.

function HideNewButtonInLookupControl(executionContext){            

        try {      

                 var formContext = executionContext.getFormContext(); 

                 var lookUpLogicalName = "new_account"

                 var lookupAttributeControl = formContext.getControl(lookUpLogicalName); 

                 if (lookupAttributeControl !== undefined && lookupAttributeControl !== null ){      

                       lookupAttributeControl.controlDescriptor.Parameters.IsInlineNewEnabled  = "false"

                  }

             }catch (e) {

             } 

 } 

Comments

Post a Comment

Popular posts from this blog

Hide +New Record button in Dynamics 365 lookup Field