Hello experts,
I am going around in circles attempting to create a concatenated column derived from a date/time field.
The code I am using is as follows:
------------------------------------------------
function onChange_dov()
{
var objdate = Xrm.Page.getAttribute("rst_asset_dov").getValue();
if (objdate != null)
{
var year = objdate.toLocaleDateString('en', {year: '2-digit'});
var month = objdate.toLocaleDateString('en', {month: '2-digit'});
Xrm.Page.getAttribute("rst_asset_dov_col").setValue((month + "/" + year));
Xrm.Page.getAttribute("rst_asset_dov_col").setSubmitMode('always');
}
}
----------------------------------------------------
The error I get is telling me the setValue is null:
----------------------------------------------------
One of the scripts for this record has caused an error. For more details, download the log file.
Where I test the code and variables and output using objdate = new Date();, there is no issue, it presents 02/22 as I would expect.
Any suggestions would be greatly appreciated.
Thank you in advance,
Jayden.