Skip to main content

Notifications

Announcements

No record found.

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();
    }
  • Suggested answer
    Anks27 Profile Picture
    1,083 on at
    RE: How to put a currency field value in a odata get url

    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

  • Suggested answer
    Inogic Profile Picture
    599 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!

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Holly Huffman Profile Picture

Holly Huffman 103

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 96 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 51 Most Valuable Professional

Product updates

Dynamics 365 release plans