You might be reading this topic, and think it’s just scripting, and just like any other form. What’s different?
Now, most fields we can script against without a problem. But let’s focus on the Extended Amount field. There is a system calculation that takes place, and if you try to enable the field for editing on the form, you will realize that you can’t.
var calculatedValue = … ; // put your formula here
Don’t be fooled by the fact that the field value indeed updates, because that’s only on the screen. Once you save the Quote Product, the value automatically gets re-calculated based on the built-in formula, and your result is off.
The way to override that value is by writing a plugin, but that’s besides the point of this post. I was looking at alternatives using JS. In some circumstances you just can’t get the result you want without writing a plugin, but for easy things, you could basically take the following approach:
- Create a new Unit Price field on the form.
- Hide the default Unit Price field.
- Do your calculations based on the custom Unit price field, update the unit price (adding discounts and other adjustments you want to make), and populate the new value in the default Unit Price field (the one you have hidden).
- Using this new price, you can take advantage of the system calculation, and make sure the Extended Price gets updated.
For a Write In product, this is not a problem, but for an Existing product, this will only work if Override Price is selected. Otherwise, the calculated value is based on the price as it’s defined in the price list associated product.
I’m interested in changing quote Total Amount behaviour, without creating a new custom field for it.
In the post you mentioned “The way to override that value is by writing a plugin ” Could you tell me if this is possible for Total Amount?
I know next to nothing about CRM 2011 plugings so if you have any additional information about it , it would be very helpful