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

Error : Cannot read properties of null (reading 'lead') while creating new record in lead entity

$
0
0
<!DOCTYPE html>
<html>
<head>
<title>Page for XRM WEBAPI Create Record in Student Entity</title>
<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
<script type="text/javascript">

function create()
{
    var entity = {
        subject : document.getElementById('subject').value,
        companyname : document.getElementById('companyname').value,
        firstname : document.getElementById('firstname').value,
        lastname : document.getElementById('lastname').value,
        msdyn_ordertype : document.getElementById('ordertype').value,
        new_businessname : document.getElementById('businessname').value,
        new_dateofbirth : document.getElementById('dob').value
};

        Xrm.WebApi.createRecord("lead"entity).then(
            function success(result) {
                var newEntityId = result.id;
                xrm.Utility.alertDialog("ID : " + result.id);
            },
            function(error) {
                Xrm.Utility.alertDialog(error.message);
            }
        );
}

</script>
</head>
<body>
<div>
    <h1>Create Record in Student Enitity</h1>
    <p>This is testing page for creating record by XRM.webapi.Create Record for <b>Lead</b> Enitity.</p>
</div>
<div>

<div>
    <h4>Subject</h4>
    <input type="text" id="subject" />
    <br> 

    <h4>Company Name</h4>
    <input type="text" id="companyname" />
    <br> 

    <h4>First Name</h4>
    <input type="text" id="firstname" />
    <br> 

    <h4>Last Name</h4>
    <input type="text" id="lastname" />
    <br> 

    <h4>Business Name</h4>
    <input type="text" id="businessname" />
    <br> 

    <h4>Date of Birth </h4>
    <input type="date" id="dob" />
    <br> 

    <h4>Order Type : 192350000</h4>
    <!---192350000-->
    <input type="number" id="ordertype" />
</div>

<br>    
<input type="button" value="Create Record" onclick="create()"/>
</div>



</body>
</html>

Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images