Skip to main content



No record found.

Microsoft Dynamics CRM forum
Suggested answer

How to put a currency field value in a odata get url

Posted on by 250

Hello everyone, my name is Taniguchi

I used the crm rest builder to build an odata retrieve multiple and the conditions that i put worked and  the crm rest builder queried the result just fine but on my code just keeping giving the result bad request because of the value i took from the currency field.

How can i format the currency fild value to put in the odata get url ?

my code:

var ngd_businessline = formContext.getAttribute("ngd_businessline").getValue();
    var revenue = formContext.getAttribute("revenue");
    var ngd_businesslineid = ngd_businessline[0].id.slice(1,-1);

    if(ngd_businessline != null && revenue != null){

        var req = new XMLHttpRequest();"GET"Xrm.Page.context.getClientUrl() + "/api/data/v9.1/neog_size_classifications?$select=_neog_size_value&$filter=_neog_business_line_value eq " + ngd_businesslineid + " and  neog_revenue_from lt " + revenue + " and  neog_revenue_to gt 9000"true);
        req.setRequestHeader("Content-Type""application/json; charset=utf-8");
        req.onreadystatechange = function() {
            if (this.readyState === 4) {
                req.onreadystatechange = null;
                if (this.status === 200) {
                    var results = JSON.parse(this.response);
                } else {
  • Suggested answer
    Anks27 Profile Picture
    Anks27 1,083 on at
    RE: How to put a currency field value in a odata get url


    Can you please change the line formContext.getAttribute("revenue") to formContext.getAttribute("revenue").getValue() and see if it works?

    Signed, Sealed and Delivered.

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.


    Thanks & Regards,

    Ankit Shah(MCT-Microsoft Certified Trainer || Dynamics 365/Business Development Manager)

    Follow/Connect 101 on below






  • Suggested answer
    Inogic Profile Picture
    Inogic 23,963 on at
    RE: How to put a currency field value in a odata get url
    Hi TaniSantos,
    You’re passing the whole attribute in the request rather than the value it contains.
    Simply add .getValue() at the end to make it var revenue = formContext.getAttribute("revenue").getValue(); and it’ll be good to go.
    Hope this helps!

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans