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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

JavaScript vs Business Rules for Math Functions

(0) ShareShare
ReportReport
Posted on by 10

I am currently trying to multiply two existing fields (field1 and field 2) and the to divide the result by 100 to return a percentage to an existing field called field3. Which method would adhere to best practices the closest (if either):

Scenario A:

Create a hidden field on the form to store the value of field1 * field 2 and then divide the hidden field by 100 (using a Business Rule to handle all the calculations)

Scenario B:

Use JavaScript to handle the entire calculation and place OnChange Event Handlers on field1 and field2

My main focus is to complete the calculation and to reduce the amount of time the form takes to load.

Thanks,

Ben

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I believe speed will be the same so you can use any of ways.

  • bw17 Profile Picture
    10 on at

    Thanks for the quick reply

  • Pawns or Kings Profile Picture
    on at

    Hi Ben,

    While the speed will be essentially the same, in terms of best practices, Microsoft encourages you use their interface as much as possible. Writing custom code, especially as it transitions from one version to the next, could result in some bugs.

    Furthermore, instead of a business rule, you could also just set Field3 to a calculated field and edit the properties of the calculation.

    0525.Capture.PNG

    Next to Field Type, click the edit button, and you will get an interface like this:

    0525.Capture.PNG

    I hope this helps.

    Regards,

    David

  • bw17 Profile Picture
    10 on at

    Thanks for the advice David, I did consider using a calculated field however field3 is an existing field required by the system which I cannot change.

  • Pawns or Kings Profile Picture
    on at

    Ah, okay. Yes, in that case, you would either have to use a business rule or custom JavaScript. I recommend using the business rule for the reasons outlined in my previous response.

    Good luck!

    David

  • arif imteyaz Profile Picture
    375 on at

    Business Rule is recommended by Microsoft.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans