Disable a composite control’s individual element in Dynamics CRM

Just the other day we had a requirement from the client where the in the contact form, if the user enters the zip code, state and the City would be populated automatically based on the zip code entered and the user should not be able to edit the state and the City fields.

Simple isn’t it. City schema name is address1_city and for state it is address1_stateorprovince. So my colleague was trying the following statements.



And sadly enough it did not work. My colleague was getting an error.

The question is WHY? The reason is address1_city and address1_stateorprovince are individual elements of the composite control address1_composite. To fetch the individual control of the composite control, the format is <composite control name>_compositionLinkControl_<individual control name>. So to access the city control the code to do that would be as specified below.


And you are done!


Please note: This would not work in tablet client since in tablet client, all the composite controls fields are rendered individually on the form. Hence to get access to the control you just have to specify. its schema name.

About Debajit
I am a Dynamics CRM Most Valuable Professional (MVP) with 12 years of experience in Microsoft .NET Technologies and 9 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: