Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8647339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:02:44+00:00 2026-06-12T13:02:44+00:00

//Prepare ‘Account’ object and call create function function createAccount() { var new_nit = new

  • 0

//Prepare ‘Account’ object and call create function

function createAccount() {

var new_nit = new Object();

// Set text field

new_nit.Name = "Maddy";
createRecord(new_nit, "new_nitSet", createAccountCompleted, null);

}

// This callback method executes on succesful account creation

function createAccountCompleted(data, textStatus, XmlHttpRequest) {

var nit = data;

alert("Account created; Id: ");

}

// This function creates record by making OData call

function createRecord(entityObject, odataSetName, successCallback, errorCallback) {

//Parse the entity object into JSON

var jsonEntity = window.JSON.stringify(entityObject);

// Get Server URL

var serverUrl = Xrm.Page.context.getServerUrl();

//The OData end-point

var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";

//Asynchronous AJAX function to Create a CRM record using OData

$.ajax({

type: "POST",

contentType: "application/json; charset=utf-8",

datatype: "json",

url: serverUrl + ODATA_ENDPOINT + "/" + odataSetName,

data: jsonEntity,

beforeSend: function (XMLHttpRequest) {

//Specifying this header ensures that the results will be returned as JSON.

XMLHttpRequest.setRequestHeader("Accept", "application/json");

},

success: function (data, textStatus, XmlHttpRequest) {

if (successCallback) {

successCallback(data.d, textStatus, XmlHttpRequest);

}

},

error: function (XmlHttpRequest, textStatus, errorThrown) {

if (errorCallback)

errorCallback(XmlHttpRequest, textStatus, errorThrown);

else

alert("Error on the creation of record; Error – "+errorThrown);

}

});

}

I’m using above code to create a entity called nit. I have json2 and jQuery js files in web resource. When i run this code on button click, i’m getting error as No Transport. when i searched , i got to know that this error is because of cross site scripting. How to enable cross site scripting or how to get rid of this error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:02:46+00:00Added an answer on June 12, 2026 at 1:02 pm
      function createAccount() {
    var gid = Xrm.Page.getAttribute("new_syllabus").getValue();
    var stamail = new Object();
    stamail.new_name = "Maddy";
    stamail.new_gid = gid;
    var myurl = "http://" + window.location.host + "/" + Xrm.Page.context.getOrgUniqueName();
    //alert(gid);
    // alert(Xrm.Page.data.entity.getId());
    
    var jsoEntity = JSON.stringify(stamail);
    var createRecordReq = new XMLHttpRequest();
    
    var ODataPath = myurl + "/XRMServices/2011/OrganizationData.svc";
    
    createRecordReq.open("POST", ODataPath + "/new_nitSet", false);
    createRecordReq.setRequestHeader("Accept", "application/json");
    createRecordReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    
    // createRecordReq.onreadystatechange = function () { requestCallBack(this); };
    createRecordReq.send(jsoEntity);
    
    var newRecord = JSON.parse(createRecordReq.responseText).d;
    
    }
    

    Instead of using ajax i used above code. Its working fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to prepare a text for the use in a LaTeX document. I
Should I prepare a empty DB inadvance while using the SQliteOpenHelper to create db
I currently prepare an existing iOS app for the new iPad with iOS 5.1
I have created a new local Windows account and want to modify some of
I'm new to MySQL and databases in general. I'm trying to create a MySQL
My company gets a set of CSV files full of bank account info each
I work on a site where visitors can create an account, and to do
Edit: Prepare my objects for the use within a HashMap. after reading a bit
Trying to prepare good build environment for my js library. According to reviews on
I need to prepare some input data to run through a program, the data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.