Hi,
I created a very simple script to be able to lock the Status field (WWSTAT in CRS692/E). Basically, this works, (see attachment) but....
If I create a new Bank Account, the STAT field is null. For that reason (as you can see in the script) I set the default value "10" if WWSTAT is null.
But it seems that ScriptUtil.SetFieldValue("WWSTAT", "10"); doesn't initialize the field as expected.
On the attached screenshot you can see that WWSTAT display the value of "10" due to the initialization but in the background the field seems to be empty. The field validation is saying that the field is empty.
Any idea how I can solve this init. problem?

var NC_M3_CRS692_ReadOnlyField_H5Script = new function() {
//////////////////////////////
/// * Global Variables * ///
//////////////////////////////
var _controller;
var _content;
var _debug;
var _arguments;
var _isDebug = true;
// Program specific
var $_host;
/**
* Script initialization function.
*/
this.Init = function(scriptArgs) {
var $cont = scriptArgs.controller;
var content = $cont.RenderEngine.Content;
var $WWSTAT;
try {
//////////////////////////////
///* Set Global Variables *///
//////////////////////////////
_controller = scriptArgs.controller;
_content = _controller.RenderEngine.Content;
_debug = scriptArgs.debug;
_arguments = scriptArgs.args;
$_host = _controller.ParentWindow;
//////////////////////////////////
$WWSTAT = ScriptUtil.FindChild($_host, "WWSTAT");
console.log("$WWSTAT.val() --> " + $WWSTAT.val());
$( "#WWSTAT").prop( "disabled", true );
if ($WWSTAT.val() == null){
ScriptUtil.SetFieldValue("WWSTAT", "10");
}
console.log("$_host --> " + $_host);
} catch (ex) {
Log(ex);
}
}
function Log(text) {
if (_isDebug) {
_debug.WriteLine(text);
}
}
}