, , , , , , , ,

Hello Everyone,

Just wanted to point out a small issue with Money field while using oData(REST). When you use oData to retrieve values for a Entity1 record and set it to another Entity2 record, then some field values need data conversion(like Money Field).

In case while you use your oData Query link to fetch values of a record in I.E. and you end up with the screen below:

The you would probably need some Setting change in your I.E.

  • Open Internet Settings
  • Move to Content Tab 
  • Click Settings under Feeds and Web Slices
  • Remove Check from Advanced option Turn on Feed reading view

After you are done with the above settings then probably after an I.E. restart you will see the following screen as a result of your oData Query.

Now coming back to the issue detail, in one of my JScripts I was fetching the Product Value from Product Entity using oData(REST) and Setting up the same value to one of my Custom Entity field. Even though the values being fetched were correct but still while Setting up the Money Field it threw following Error on page.

This control only accepts number or null as input.

I then came across a blog which explains about this in details here. It says that some values needs conversion (like Money Field). Hence I changed my jScript from


and it worked perfectly onwards without any errors.

My oData Query to fetch values from Product Entity and Set to field in Custom Entity is as follows:

function SetPrice(results,price) {

//here is where you’d add the code to handle the data returned
if (results[0].StandardCost.Value != null)
                        var value = results[0].StandardCost.Value;

function getPrice(product,price) 
    var pdt= Xrm.Page.data.entity.attributes.get(product);

    if (pdt.getValue() == null)
pdtId = pdt.getValue()[0].id;
var pagecontext = Xrm.Page.context;
var serverUrl = pagecontext.getServerUrl();
var oDataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var oDataSelect = oDataPath + "/ProductSet?$select=StandardCost&$filter=ProductId" + " eq guid'" + pdtId + "'";

type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: oDataSelect,

beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },

success: function (data, textStatus, XmlHttpRequest) {

error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + oDataSelect ); }


Hope this was helpful.

Thanks !!!