<html>
<head>
<!-- Activate IE9 document mode, if available -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=false">
<meta name="viewport" content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript" src="../jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../Schema.js"></script>
<script type="text/javascript" src="../Enums.js"></script>
<script type="text/javascript" src="../Common.js"></script>
<script type="text/javascript" src="JSBridge.js" ></script>
</head>
<body onload="pageload();" onChange="pageload();">
<body>
<h3> Hello </h3>
<input type="text" id="test1"></input>
<input type="text" id="test2"></input>
<input type="text" id="test3"></input>
<input type="text" id="test4"></input>
<script>
function pageload(){
document.getElementById("test1").value="abc";
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
document.getElementById("test2").value="efg";
mainFunction(entityForm);
return true;
}, MobileCRM.bridge.alert, null);
function mainFunction(entityForm){
document.getElementById("test2").value="efg";
var accountEntity = entityForm.entity;
accountEntity.properties.name = "abc";
accountEntity.properties.emailaddress1 = "aakashc276@gmail.com";
MobileCRM.bridge.alert("yes");
var xhr = new XMLHttpRequest();
xhr.onload = function () {
document.getElementById("test4").value=xhr.responseText;
var firstname = xhr.responseText.data.name;
accountEntity.properties.name = firstname;
xhr.send();
}
}
}
</script>
</body>
</html>