web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

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

(0) ShareShare
ReportReport
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();
        req.open("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("OData-MaxVersion""4.0");
        req.setRequestHeader("OData-Version""4.0");
        req.setRequestHeader("Accept""application/json");
        req.setRequestHeader("Content-Type""application/json; charset=utf-8");
        req.setRequestHeader("Prefer""odata.include-annotations=\"*\"");
        req.onreadystatechange = function() {
            if (this.readyState === 4) {
                req.onreadystatechange = null;
                if (this.status === 200) {
                    var results = JSON.parse(this.response);
 
                } else {
                Xrm.Utility.alertDialog(this.statusText);
                }
            }
        };
        req.send();
    }
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    748 on at
    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!
  • Suggested answer
    Anks27 Profile Picture
    1,087 on at

    Hello,

    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

    LinkedIn:-   https://linkedin.com/in/dynamicpower101/

    Twitter:-     https://twitter.com/Dynamicpower101

    Facebook:- https://facebook.com/DynamicPower101/

    Telegram:- https://t.me/dynamicpower101

    Medium:-   https://medium.com/dynamicpower101

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 184 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 125

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans