Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Calculated Fields

(0) ShareShare
ReportReport
Posted on by

I want to create a calculated field in CRM 2011

Calculated Field = Category A + Category B + Category C

The category values are as follows

  • Category A ['sc_categorya']

    • 1 = 70

    • 2 = 14

  • Category B ['sc_categoryb']

    • 1 = 40

    • 2 = 65

    • 3 = 90
  • Category C ['sc_categoryc']

    • 1 = 25

    • 2 = 50

Any help would be greatly appreciated, my js file is below.

Do I need to add the OnChange event to each field?

function calculate()
{
var val1 = Xrm.Page.entity.attributes.get['sc_categorya'].getValue();
var val2 = Xrm.Page.entity.attributes.get['sc_categoryb'].getValue();
var val3 = Xrm.Page.entity.attributes.get['sc_categoryc'].getValue();

if(val1=='1') {val1 = 70;}
else if(val1=='2') {val1 = 140;}


if(val2=='1') {val2 = 40;}
else if(val2=='2') {val2 = 65;}
else if(val2=='3') {val2 = 90;}

if(val3=='1') {val3 = 25;}
else if(val3=='2') {val3 = 50;}
else if(val3=='3') {val3 = 75;}

var result = val1 + val2 + val3;
 Xrm.Page.entity.attributes.get['sc_calculatedfield'].setValue(result);
}



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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,850 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans