locked
Multiple a field by 12 (calculate a yearly value) RRS feed

  • Question

  • Hi Guys

    simple question - in contracts I have a dollar value form that summarizes all the contract line items. The line items in the contract are a per month cost so the field is the total per month cost (so good so far) I would like to have a total  per year cost so in short take the total per month cost field and times by 12 - I assume this has to be done by java script - can any one enlighten me into the easiest way to achieve this

    thanks in advance

    Dan

    Monday, August 26, 2013 5:44 AM

All replies

  • Hi Dan,

    You are correct that this can be done in JavaScript. Add on OnChange event to the Total Per Month field and call a method similar to below:

    function new_totalpermonth_OnChange(){
      if (Xrm.Page.getAttribute('new_totalpermonth').getValue() != null){
        Xrm.Page.getAttribute('new_totalperyear').setValue(Xrm.Page.getAttribute('new_totalpermonth').getValue() * 12)
      }
    }


    Michael Palmer
    xRMPalmer     @MJFPalmer     Rockstar365

    Monday, August 26, 2013 6:09 AM