locked
CRM 2013 - Javascript - Quote Product Not Updating RRS feed

  • Question

  • Hi 

    Within the entity quote I can add products to the quote

    To get the product I'm using a lookup to get the product details which include its price, the price is inputted into the field "baseamount

    I want to be able to apply the discount if necessary to the product and that will then update the extendedamount field which is being used as an overall amount for that product. I've applied javascript to do the calculations for the discount and the extended amount field gets updated to the new price

    However, as soon as the save button is clicked, the price reverts back to its original price meaning that the discount no longer applies

    Any ideas as to why this is happening?

    Thanks, Shaun


    S.Harrison

    Tuesday, July 15, 2014 12:19 PM

Answers

  • Hi Shaun,

    CRM has some internal logic to calculate extended amount as (PricePerUnit * Quantity - ManualDiscount +Tax).

    Even if you write a plugin for updating extended amount, then also it will override the extended amount.

    If "Manual discount" field is not in use then you can add discount in this field using script and rest calculations will be done by CRM itself.

    If you are using "Manual discount" field then alternative for this is,

    1. Create a custom Manual discount field which will be visible to user and user can enter value in it.
    2. Hide OOB "Manual discount" field and using the script add your custom discount with "Manual discount(custom)" and set it to "Manual discount(OOB)" field.

    HTH!

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" 


    Thursday, July 17, 2014 12:53 PM

All replies

  • Hi Shaun,

    I think there is already a business rule in the field(amount) which is using in javascript to update.

    So make it confirm, there is no any business rule running for the related field.


    Tuesday, July 15, 2014 12:33 PM
  • Hi Suresh

    The business rules button on the form is disabled, does that mean there isn't any or is that my problem?

    My javascript is under Form Properties and there is no other javascript in that area

    Thanks, Shaun


    S.Harrison

    Tuesday, July 15, 2014 12:37 PM
  • Hi Shaun,

    CRM has some internal logic to calculate extended amount as (PricePerUnit * Quantity - ManualDiscount +Tax).

    Even if you write a plugin for updating extended amount, then also it will override the extended amount.

    If "Manual discount" field is not in use then you can add discount in this field using script and rest calculations will be done by CRM itself.

    If you are using "Manual discount" field then alternative for this is,

    1. Create a custom Manual discount field which will be visible to user and user can enter value in it.
    2. Hide OOB "Manual discount" field and using the script add your custom discount with "Manual discount(custom)" and set it to "Manual discount(OOB)" field.

    HTH!

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" 


    Thursday, July 17, 2014 12:53 PM