Asked by:
how to Enable and Disable Lookup Fields ?

Question
-
Microsoft Dynamics CRM 2011
In contact form if enter any name in lastname field the primary contact field will be Enabled using JavaScript .
note :- Primary contact Fields is already disabled
reply.....
naveen
Friday, July 4, 2014 9:34 AM
All replies
-
Microsoft Dynamics CRM 2011
In contact form if enter any name in lastname field the primary contact field will be Enabled using JavaScript .
note :- Primary contact Fields is already disabled
reply.....
naveen
- Merged by HIMBAPModerator Sunday, July 6, 2014 7:46 AM duplicate
Friday, July 4, 2014 9:25 AM -
Hi,
Just to clarify something, is Primary Contact field a custom field in your Contact entity? Because by default, the Primary Contact is present in Account. Either way, I'll provide the code, so just replace your field name accordingly. Use this script OnChange of LastName and OnLoad of Form:
var _lastName = Xrm.Page.getAttribute("lastname").getValue(); if (_lastName!=null && _lastName!="") { Xrm.Page.ui.controls.get("primary_contact_field_name").setDisabled(false); } else { Xrm.Page.ui.controls.get("primary_contact_field_name").setDisabled(true); }
Make sure to replace primary_contact_field_name with the actual field schema name.Friday, July 4, 2014 9:36 AM -
Hi,
Just to clarify something, is Primary Contact field a custom field in your Contact entity? Because by default, the Primary Contact is present in Account. Either way, I'll provide the code, so just replace your field name accordingly. Use this script OnChange of LastName and OnLoad of Form:
var _lastName = Xrm.Page.getAttribute("lastname").getValue(); if (_lastName!=null && _lastName!="") { Xrm.Page.ui.controls.get("primary_contact_field_name").setDisabled(false); } else { Xrm.Page.ui.controls.get("primary_contact_field_name").setDisabled(true); }
Make sure to replace primary_contact_field_name with the actual field schema name.- Proposed as answer by Anupam Bishui Friday, July 4, 2014 11:22 AM
Friday, July 4, 2014 9:37 AM -
http://blog.simpletrees.com/2014/02/dynamics-crm-enablingdisabling-fields.html
ms crm
Friday, July 4, 2014 10:23 AM -
Yes it is Primary Contact field a custom field in your Contact entity
thank you for u Reply
Friday, July 4, 2014 11:15 AM