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)

Convert items in Option Set into Value (Currency)

(0) ShareShare
ReportReport
Posted on by

Hi,

I have an optionset (Probability %) that has values 10, 25, 50, 75 and my opportunity form has a weighted opp value field which basically takes the (Total Value * probability)/100.

How do I change the value in the Probability option set into a currency type (Total Value and opp value are both currency) and perform the calculation?

Thanks

*This post is locked for comments

  • SharjeelButt Profile Picture
    on at
    RE: Convert items in Option Set into Value (Currency)

    Hi Guido,

    Thanks for the response. However, I'm getting the error that I need to enter a value between the range of -1,000,000,000.0000 to 1,000,000,000.0000,

  • Suggested answer
    Karth Profile Picture
    on at
    RE: Convert items in Option Set into Value (Currency)

    Replace this...

    Xrm.Page.getAttribure("new_finalvalue").setValue(finalValue);

    with this..

    Xrm.Page.getAttribute("new_finalvalue").setValue(parseFloat(eval(finalValue)));

    Let me know if this works.

    Cheers,

    Karth

  • SharjeelButt Profile Picture
    on at
    RE: Convert items in Option Set into Value (Currency)

    This is the error I get even with replacing the code:

     

  • SharjeelButt Profile Picture
    on at
    RE: Convert items in Option Set into Value (Currency)

    My code is:

    function calculateTotal()

    {

    var soft = Xrm.Page.getAttribute("new_softwarerevenue").getValue();

    var serv = Xrm.Page.getAttribute("new_servicerevenue").getValue();

    var dev = Xrm.Page.getAttribute("new_developerrevenue").getValue();

    var oth = Xrm.Page.getAttribute("new_otherrevenue").getValue();

    var tot = Xrm.Page.getAttribute("new_totalestimatedrevenue");

    var add = soft+serv+oth+dev;

    if(soft !=null || serv != null || dev != null || oth != null)

    {

    tot.setValue(add);

    }

    else {return;}

    var probability = Xrm.Page.getAttribute("new_probability").getText();

    if (probability != "")

    {

      var percent = parseFloat(probability);

      var oppValue = tot * percent/100;    

      Xrm.Page.getAttribute("new_opportunityvalue").setValue(parseFloat(eval(oppValue)));

    }

    }

  • SharjeelButt Profile Picture
    on at
    RE: Convert items in Option Set into Value (Currency)

    @Guido: Thank you much! It worked!

    @Karth: Thank you for your input. That code will def guide me to use it appropriately in future cases!

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans