Quantcast
Channel: CRM Development Forum
Viewing all articles
Browse latest Browse all 888

Calculating fields not working

$
0
0

I though I was doing something simple, but I cannot get two fields to add together and put the results into a third field.  I carefully followed the instructions at this link.  http://community.dynamics.com/product/crm/crmtechnical/b/mshelp/archive/2011/03/14/creating-a-calculated-field-in-dynamics-crm2011.aspx

I added three fields, Air, Hotel, and Total to a newly made Expense form,  Added the Java script in the web resources and added the resource to the form and individual fields properties.

When I try to add a new record I immediatly get a script error as follows:

Line: 1

Char: 2

Error: Expected ';'

Code: 0

URL: http://  our server info

7D/WebResources/new_Calculate1  (Calculate1 is the name I gave the resource)

Once I say OK, I can enter $s into Air or Hotel, but get the error:

  There was an error with this field's customized event.

  Field:new_air

  Event:onchange

  Error: The value of the property 'Add_Air' is null or undefined, not a function object.

  I get the same error on the Hotel field.

Following is the script I used.

1: function calculate()

2: {

3:     var Air = Xrm.Page.entity.attributes.get['new_air].getValue();

4:     var Hotel = Xrm.Page.entity.attributes.get['new_hotel'].getValue();

5:     var total = Air + Hotel

6:     if(Air==null)return;

7:     if(Hotel==null)return;

I think I'm just missing something simple, but surely can't seem to find it. I'm not a programmer, but can usually figure things out.

Any help is appreciated.


Viewing all articles
Browse latest Browse all 888


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>