Hi,
I have the following JavaScript:
var Sdk = window.Sdk || {};
(function () {
// Define global variable
var currentUserName = Xrm.Utility.getGlobalContext().userSettings.userName;
// Code to run in the form OnLoad event
this.formOnLoad = function (executionContext) {
var formContext = executionContext.getFormContext();
}
// Code to run in the attribute OnChange event
this.attributeOnChange = function (executionContext) {
var formContext = executionContext.getFormContext();
// Automatically set Current User
alert(currentUserName);
formContext.getAttribute("new_currentuser").setValue(currentUserName);
}
}).call(Sdk);
However the Field: new_currentuser is not getting populated and the alert is not displaying.
Form Properties: I have the New Web Resource
Form OnLoad: Sdk.formOnLoad
Field Property: OnChange event: Sdk.attributeOnChange
All are enabled, saved and publish
What am I missing.
Thanks for your help
*This post is locked for comments