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
parentForm.name.disabled=true;
// loop through all the fields and disable them
for(i=0; i<parentForm.elements.length; i++)
{
parentForm.elements[i].disabled=true;
}
// lookups need to be disabled separately
parentForm.parentaccountid.disabled=true;
}
}
Bye…
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

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
LikeLike