calculating fields

This question has suggested answer(s)

I have searched through the forums and found a few posts regarding calculating fields, I have tried these and cannot seem to make them work for me!

I have 6 fields which I need to add up and the total displayed in the 7th field. Should this work:


 It does not seem to work for there something obvious i am doing wrong??





All Replies
  • it might be easier using a derived field and doing the calculation in a view or updating the field via an escalation rule or a table script

  • did you miss out the character ";" at the end of the statement ? was it an expected error or something else?


    Kannan Srinivasan

  • Thanks i am going to look into this

  • i have tried it with and without its still not working. Thanks

  • i found another method of doing it however it only works for adding up two fields! if i use


    this adds those two fields up into the thrid. i have tried adding more fields to this code but it doesnt work so not sure.  i.e


  • Hello Jen,

    Take the fields you need to calculate and place them into variables.


    var myvar1 = oppo_soscollaboration.value;

    var myvar3 = oppo_sospower.value;

    var myvar4 = oppo_soscrta.value;

    var myvar5 = oppo_sosvalue.value;

    var myvar6 = oppo_sosvision.value;

    var myvar7 = oppo_sospain.value;

    Next, put your calculation into a variable:

    var myvarsosTotal = (parseFloat(myvar1) + parseFloat(myvar4) + parseFloat(myvar5) + parseFloat(myvar6) + parseFloat(myvar7) + parseFloat(myvar3));

    set your field to show the calculation result and fix it to 2 decimal.

    oppo_sostotal.value = myvarsosTotal.toFixed(2);

    Let me know if this helps Jen.



  • Thanks everyone! I have finally managed to get it to work using the following:

    var oppo_soscollaboration = crm.fields('oppo_soscollaboration').value();

    var oppo_soscrta = crm.fields('oppo_soscrta').value();

    var oppo_sosvalue = crm.fields('oppo_sosvalue').value();

    var oppo_sosvision = crm.fields('oppo_sosvision').value();

    var oppo_sospain = crm.fields('oppo_sospain').value();

    var oppo_sospower = crm.fields('oppo_sospower').value();

    var thetotal = parseFloat(oppo_soscollaboration) + parseFloat(oppo_soscrta) + parseFloat(oppo_sosvalue) + parseFloat(oppo_sosvision) + parseFloat(oppo_sospain) + parseFloat(oppo_sospower);