Disable parent form fields from related entities form

We had a requirement like when a opportunity record is created from within an account form, the fields in the account form should get disabled.

This is the JavaScript that could be used for doing so, it is on the onSave event of the Opportunity form.


if (
(window.opener != null) &&
(window.opener.parent != null) &&
(window.opener.parent.document != null) &&
(window.opener.parent.document.crmForm != null)) {

var parentForm = window.opener.parent.document.crmForm;

if (parentForm.ObjectTypeName == "account")

// disabling field individually

// loop through all the fields and disable them

for(i=0; i<parentForm.elements.length; i++)

// lookups need to be disabled separately






Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

One thought on “Disable parent form fields from related entities form”

  1. Apologize for my bad english, I deem its a nice piece of your writing. Famously I have faced alot of difficulties in this term but your article will definately help me in future. Say thank you You


Please share your thoughts

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.