Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 87499

Create record using sdk.rest.js

$
0
0

Hi all,

I am creating record from js. I used the following code:

function Configuration() {
debugger;

var account = {};
account.Name = "Test Account Name";
account.Description = "This account was created by the JavaScriptRESTDataOperations sample.";

//Set a picklist value

account.PreferredContactMethodCode = { Value: 2 }; //E-mail

//Set a money value

account.Revenue = { Value: "2000000.00" }; //Set Annual Revenue

//Set a Boolean value

account.DoNotPhone = true; //Do Not Allow

//Add Two Tasks
var today = new Date();
var startDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 3); //Set a date three days in the future.

var LowPriTask = { Subject: "Low Priority Task", ScheduledStart: startDate, PriorityCode: { Value: 0} }; //Low Priority Task
var HighPriTask = { Subject: "High Priority Task", ScheduledStart: startDate, PriorityCode: { Value: 2} }; //High Priority Task
account.Account_Tasks = [LowPriTask, HighPriTask]

//Create the Account
SDK.REST.createRecord(
account,
"Account",
function (account) {
alert("Test");
},
errorHandler
);
}
function errorHandler(error) {
alert("Test from error handler");
}

and It is giving me below error:

What is the mistake in my code?

Thank You


Viewing all articles
Browse latest Browse all 87499

Trending Articles



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