CRM Online Calculations

I have an aold CRM system we are upgrading to CRM Online.
There are a number of calculations carried out by Javascript in the system which we are hoping to replace with Business Rules or Calculated fields. We are finding this difficult to do due to the complexity of the Javascript.
I have copied in a snippet of the Javascript, would anyone know if it’s possible to do this another way other than through Javascript?

If (estimate >= appsEst) {
if (type == “A” && estimate != null && appsEst != null && income != null) {
if (income <= 37500) {
grantAmt = appsEstimate * 1.00;
grantField.setValue(grantAmt > 40000 ? 40000 : grantAmt);
Per.setValue(“1.00”);
}
else if (income <= 43750) {
grantAmt = appsEstimate * 0.85;
grantField.setValue(grantAmt > 34000 ? 34000 : grantAmt);
Per.setValue(“0.85”);
}
else if (income <= 50000) {
grantAmt = appsEstimate * 0.75;
grantField.setValue(grantAmt > 30000 ? 30000 : grantAmt);
Per.setValue(“0.75”);
}
}

Hi,

Yes, you can move this logic out of JavaScript. Business Central CRM (Dataverse) gives a few practical options depending on how complex the rules are and where they need to run.

  1. Business Rules (easy, no-code)
    Good if the logic only needs to run on the form. You can create conditions for the income ranges and set the grant amount and percentage. Just note Business Rules don’t always run on imports or API updates.

  2. Calculated Fields
    Works well if the values can be read-only. You can use conditional expressions (IIF) to handle income brackets and caps (e.g., if result > max then max). Good for consistent server-side calculation.

  3. Power Automate Flow
    Runs on the server and works for any update (form, import, integration). You can recreate the same if/else logic and update the fields. Slight delay, but very reliable.

  4. Plugin (C#)
    Best if the logic is heavy, used everywhere, or must be fully controlled on the server. More effort, but the most robust option.

Your snippet fits easily into any of these:
• Check main condition (estimate >= appsEst, type = “A”, fields not empty)
• Then apply income ranges and caps
• Set grant amount and percentage values

If you want, I’m happy to jump on a quick free knowledge-sharing call and look at your JavaScript to suggest the cleanest approach.