OnSave Event on Opportunity Form (hide field)

From Linkedin discussion:OnSave Event on Opportunity Form

So I created two custom fields for the opportunity form. One is Quantity and One is Value. They are named with the custom _. So what I want is the Estimated Revenue field to be Quantity x Value. To do this first I have to enable the OnSave event. Secondly, I want to disable the System Calculated Estimated Revenue. How would one achieve this.

Neil Benson • Hi Atif, you can write JavaScript that will calculate the value of a field.

For example:
crmForm.all.estimatevaled.DataValue = crmForm.all.[new_quanity].DataValue * crmForm.all.[new_value].DataValue;

You can’t disable the system calculated estimated revenue field, but you can set the default value to be User Provided and then either hide the field or move it to a hidden tab. Here’s how to hide a field: http://jianwang.blogspot.com/2007/11/crm-how-to-hide-field-label-line.html .

Rami Heleg • faster way to hide field:

function HideField(fieldName, visible) {
var label = document.getElementById(fieldName + ‘_c’);
var value = document.getElementById(fieldName + ‘_d’);
if (label)
label.style.display = visible ? ‘inline’ : ‘none’;
if (value)
value.style.display = visible ? ‘inline’ : ‘none’;
}

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: