How can I access form field values using Javascript in Dynamics 365 online? This is what I've tried:
A script web resource with an "onload" event called on the form "load". This doesn't work. I get [Object object]
but I expect a string. Debugging it shows no properties with the value of the field
function loadForm()
{
var value1 = Xrm.Page.data.entity.attributes.get("new_dealercode").getValue();
alert(value1);
}
An HTML web resource that I include on the form, this does nothing, but I know it's being called because if I put an alert on it, it is alerted.
<html>
<head>
<script type="text/javascript">
var value1 = window.parent.Xrm.Page.getAttribute("new_dealercoder").getValue();
alert(value1);
</script><meta charset="utf-8">
</head><body><br></body>
</html>
What I'm trying to achieve: An Iframe with dynamic "src" based on a field value on the form.