Calculated Field - nothing happens in Sage CRM Cloud?

Hi, New here -

I'm using demo of Sage CRM Cloud and am trying to get two fields to add together.

From my reading it seems that 'Onchange' script is the way to go, however nothing happens when I change the fields.

My code is here (inserted in both fields onchage):

var LPP = parseInt(document.EntryForm.sand_lastpricepaid.value); var PP = parseInt(document.EntryForm.sand_petoprice.value); document.EntryForm.sand_pricedifference.value = (LPP + PP);

EDIT:

I should probably mention that my custom entity is Sandbox 1 (hence sand_). The value returned in the 'price difference' field is currently '0', the default value

All field types are set to 'Numeric'

Help appreciated!

Mike

  • 0

    I don't use cloud, but I think it is the same....

    I have mocked up similar fields in the case entity. So my code would be:

    var P1 = document.getElementById('case_price1').value;

    var P2 = document.getElementById('case_price2').value;

    var P1int = parseInt(P1);

    var P2int = parseInt(P2);

    document.getElementById('case_pricediff').value = P1int+P2int;

    I place that on the onchange of case_price1 & case_price2 and when either are changed, the sum of them both is written in case_pricediff.

    Hope that helps.

  • 0

    Hi,

    Thanks Toby - I tried it but to no avail I'm afraid :/

    It must be something to do with a custom entity - I followed this example (ie in the Opportunity Entity) to the letter and it worked fine: community.sagecrm.com/.../916.605-16522-how-do-you-create-calculated-fields-in-sage-crm.aspx

    However in my custom Sandbox Entity - no dice with any method.

    I also can't create new 'screens' - anyone know if this a demo thing?

    Help appreciated once more!

    Mike

  • 0

    As its cloud you should be able to use the client side API. Something like

    var lpp = (parseFloat(crm.fields('sand_lastpricepaid').value());

    var pp = (parseFloat(crm.fields('sand_petoprice').value());

    var priceDiff = lpp-pp;

    crm.fields('case_pricediff').value(priceDiff);

    For testing i would throw a few alerts in there to see where it gets to:

    var lpp = (parseFloat(crm.fields('sand_lastpricepaid').value());

    alert(lpp);

    var pp = (parseFloat(crm.fields('sand_petoprice').value());

    alert(pp);

    var priceDiff = lpp-pp;

    alert(priceDiff);

    crm.fields('sand_pricediff').value(priceDiff);

    One thing to check with the cloud system when using the builder in the field names on the screen dont always match the actual field name. For example sand_lastpricepaid could actually be send_lastpricepaid_value. If you right click and inspect the element you should be able to find the actual field name on the screen.

  • 0

    Hi,

    Thanks Daniel - still nothing happens, however there is some kind of progress!

    I should have mentioned that if I add the OnChange script to the 'Summary' page ('<>' link), before I wasn't able to add new records - now I can add new records, however it won't let me enter a value in those fields.

    So I guess that's progress of a sort.

    I've inspected the field names and they seem OK - however quick question: crm.fields('case_pricediff').value(priceDiff);

    Did you mean'case' to be 'sand_pricediff' on this script? I;ve tried both - still nothing.

    Also - whereabouts can I inspect the error handling? I get no alert when I enter the values... I'm in Chrome - any issues there?

    Sorry for all the questions but I sense we're getting somewhere!

    Many thanks,

    Mike