Quantcast
Channel: Sam's Activities
Viewing all articles
Browse latest Browse all 3363

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

$
0
0

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();
    }

Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>