locked
New Record Creation Error Using OData JavaScript RRS feed

  • Question

  • I have CRM 2011 IFD

    I want to Create New Record Using JavaScript Odata

    If I set Decimal or Text Fields Record create fine.

    but if set any currency filed Record not Create and show belew error

    Here is code I am using

    function CreateBikePlan(Bike,serviceLube,Retailcost) { var serverUrl = Xrm.Page.context.getServerUrl().toString(); var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc"; var ODATA_EntityCollection = "/new_bikeplanSet"; var objAccount = new Object(); // set the name of BikePlan objAccount.new_name = "BikePlan"; // set the Bike discount percentage objAccount.new_Bike =Bike; objAccount.new_ServiceLubeRebate=serviceLube;

    //set the RetailCost objAccount.new_Retailcost =parseFloat(Retailcost); // Parse the entity object into JSON var jsonEntity = window.JSON.stringify(objAccount); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", datatype: "json", url: serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection, data: jsonEntity, beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, success: function (response) { if (response != null && response.d != null) { //alert(response.d.AccountId); } }, error: function (xmlHttpRequest, textStatus, errorThrown) { alert("Status: " + textStatus + "; ErrorThrown: " + errorThrown); } }); }



    Muhammad Sohail


    • Edited by sohail450 Friday, April 18, 2014 1:04 PM
    Friday, April 18, 2014 1:02 PM

Answers