web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

javascript code for multiply two field

(0) ShareShare
ReportReport
Posted on by

I want to multiply two field as below:

function multiply()

{
var val1 = Xrm.Page.getAttribute(‘new_tax′).getValue();
var val2 = Xrm.Page.getAttribute(‘baseamount′).getValue();

if(val1==null)return;
if(val2==null)return;

var result = val1*val2;
Xrm.Page.getAttribute(‘tax’).setValue(result);
}

unfortunately I meet an error

'multiply' is undefined.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ganeshm Profile Picture
    on at
    RE: javascript code for multiply two field

    follow this link ,in case you need hint in calculated field.

    www.powerobjects.com/.../calculated-fields-in-dynamics-crm-2015

    And remember every field after its creation is read only.only things that can editable is the display name.

  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at
    RE: javascript code for multiply two field

    You have to use a new calculated field where you are going to populate the result of this multiplication of

    new_tax and baseamount

  • Suggested answer
    ganeshm Profile Picture
    on at
    RE: javascript code for multiply two field

    yes whenever you create a new field after the field creation you cant edit the field type.

    so after creating a new calculated field click edit and add your conditions

  • Community Member Profile Picture
    on at
    RE: javascript code for multiply two field

    I have to fill 'new_tax' manual and when I Create it as calculated field,it become read only and should fill automatically.

  • ganeshm Profile Picture
    on at
    RE: javascript code for multiply two field

    Created field(existing field) cannot be convert to calculated field.so try create a new field and use it

  • Community Member Profile Picture
    on at
    RE: javascript code for multiply two field

    I cant add and use simple field in action of calculated field.

  • Gopalan Bhuvanesh Profile Picture
    11,401 on at
    RE: javascript code for multiply two field

    Click Edit Library and find out the the function is available.

    JavascriptFormOnload.PNG

  • ganeshm Profile Picture
    on at
    RE: javascript code for multiply two field

    Well try to use "debugger;" in ur js and check it loaded in the form .

    Still facing the same error better to use the oob features by changing the 'tax' field as calculate field type.you can perform the same operation in them.

  • Community Member Profile Picture
    on at
    RE: javascript code for multiply two field

    Please check if the web resource where you write your javascript function is added to the form. Also please make sure that the form is published.

    using F12 debugging tool, make sure that the javascript resouces is loaded and the function is available. Keeping F12 window open clears the cache automatically.

    Jithesh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans