I have a non-people picker column in a DataTable called 'Verified by'. Whenever a new record is added to this DataTable, I would like the 'Verified by' column to auto populate which the current SharePoint user name.
Is this possible? Thanks!
I have a non-people picker column in a DataTable called 'Verified by'. Whenever a new record is added to this DataTable, I would like the 'Verified by' column to auto populate which the current SharePoint user name.
Is this possible? Thanks!
Hello @ParAvion,
You can set the value of the column in "Data Table" control with the current user name using the following code.
Please replace 'DataTable0' with the internal name of the control. Column0 - is the column InternalName.
fd.spRendered(function() {
fd.control('DataTable0').$on('change',
function(e) {
var username = _spPageContextInfo.userDisplayName;
fd.control('DataTable0').value[0].Column0 = username;
});
});
fd.spRendered(function() {
fd.control('DataTable0').$on('change',
function(e) {
var rec = parseInt(fd.control('DataTable0').value.length) - 1;
var username = _spPageContextInfo.userDisplayName;
fd.control('DataTable0').value[rec].Column0 = username;
});
});