Sunday, 7 August 2016

create record using Javascript using SDK.Rest examples

//=================================================================================
// creation  records  using mscrm2016 application
// created  by Ravi Jaala on august 5th 2016
//===============================================================

if (typeof (MscrmAplications) == "undefined") {
    MscrmAplications = { _namespace: true };
}
MscrmAplications.Studentonload =
{
    CreateRecord: function () {
        debugger;
        var student = {};
        student.new_name = "DemoExample";// string
        student.new_courseName = "MSCRMTechnologies";// string values
        student.new_CourseDuration = { Value: 100000001 }; // optionset values
        student.new_Gender = false;//Two OptionSetvalues
        student.new_Fee = { Value: "60000" }; // currency  field
        var dt = new Date(2015, 9, 8);
        student.new_startdate = dt; // date and time  field
        student.new_TotalSudents = 200;// whole numbers
        student.new_Amount = "6.2";// floating point
        student.new_Hieght = "9.9"; //decimal

        student.new_Student = { Id: "F3397DD5-1458-E611-80F1-C4346BDD3121", LogicalName: "new_students", Name: "StudentC" };//lookupvalues

        SDK.REST.createRecord(student, "new_course", MscrmAplications.Studentonload.sucessful, MscrmAplications.Studentonload.errormessage);
    },
    sucessful: function () {
        alert("sucessfuly excuted");
    },
    errormessage: function () {
        alert("Error Occured here");
    },

    _namespace: true
};



No comments:

Post a Comment