web
You’re offline. This is a read only version of the page.
close
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();
    }
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    703 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,085 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans