locked
Access Custom entity using jquery in dynamic crm 2015 RRS feed

  • Question

  • Hi,

    I have create new entity name "Test" and its schema name is "new_Test".Now i want to create a new record in that entity.

    Here is my code..Is this right? I cannot receive success here.Can you help me?

    When i am debug this code it giver me this error.


      var serverUrl = location.protocol + "//" + location.host;           
                var test = {};
                test.Name = document.getElementById('txtname').value;

                var jsonTest = window.JSON.stringify(test);
                var oDataUri = serverUrl + "/XRMServices/2011/OrganizationData.svc/new_TestSet";
                var accountServices = null;

                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    datatype: "json",
                    url: oDataUri,
                    data: jsonTest,
                    beforeSend: function (XMLHttpRequest) {
                        XMLHttpRequest.setRequestHeader("Accept", "application/json");
                    },
                    success: function (data, textStatus, XmlHttpRequest) {
                        var testDdl = $('#success_message');
                        testDdl.text("Supplier is created successfully ");
                                           
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert("error");
                    }
                });



    • Edited by NikkiShah Friday, July 31, 2015 9:03 AM
    Friday, July 31, 2015 8:15 AM

Answers

All replies