Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Arithmetic on option set fields

Posted on by Microsoft Employee

Hi Community,

I was wondering if it is possible to sum two option set fields in CRM without having to use javascript?

For example i have option set A with a value of 1, option set B with a value of 3, id like to add the two values and then store the total in a separate field.  

Many Thanks in advance. 

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Arithmetic on option set fields

    If the fiueld you want to set the value is String. Use this code:

    var value1 = Xrm.Page.getAttribute("OptionsetAFieldName").getValue();

    var value2 = Xrm.Page.getAttribute("OptionsetBFieldName").getValue();

    var sum = value1 + value2;

    Xrm.Page.getAttribute("FieldNametoSet").setValue(sum.toString());

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Arithmetic on option set fields

    Hi Moons,

    See: community.dynamics.com/.../200929

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Arithmetic on option set fields

    You can start here - msdn.microsoft.com/.../jj602964.aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Arithmetic on option set fields

    Hi Andrii,

    thank you for your reply

    Could you point me in the right direction please of some examples if possible.

    Many Thanks.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Arithmetic on option set fields

    Hello,

    I don't think that's possible. You will have to write couple of JavaScript code lines.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans